<commit_before>// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/notifications/system_notification.h"
#include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/notifications/balloon_collection.h"

namespace chromeos {

////////////////////////////////////////////////////////////////////////////////
// SystemNotification

void SystemNotification::Init(int icon_resource_id) {
  NOTIMPLEMENTED();
}

SystemNotification::SystemNotification(Profile* profile,
                                       NotificationDelegate* delegate,
                                       int icon_resource_id,
                                       const string16& title)
    : profile_(profile),
      collection_(NULL),
      delegate_(delegate),
      title_(title),
      visible_(false),
      urgent_(false) {
  NOTIMPLEMENTED();
}

SystemNotification::SystemNotification(Profile* profile,
                                       const std::string& id,
                                       int icon_resource_id,
                                       const string16& title)
    : profile_(profile),
      collection_(NULL),
      delegate_(new Delegate(id)),
      title_(title),
      visible_(false),
      urgent_(false) {
  NOTIMPLEMENTED();
}

SystemNotification::~SystemNotification() {
}

void SystemNotification::Show(const string16& message,
                              bool urgent,
                              bool sticky) {
  NOTIMPLEMENTED();
}

void SystemNotification::Show(const string16& message,
                              const string16& link,
                              MessageCallback* callback,
                              bool urgent,
                              bool sticky) {
  NOTIMPLEMENTED();
}

void SystemNotification::Hide() {
  NOTIMPLEMENTED();
}

////////////////////////////////////////////////////////////////////////////////
// SystemNotification::Delegate

SystemNotification::Delegate::Delegate(const std::string& id)
    : id_(id) {
  NOTIMPLEMENTED();
}

std::string SystemNotification::Delegate::id() const {
  NOTIMPLEMENTED();
  return id_;
}

////////////////////////////////////////////////////////////////////////////////
// XInputHierarchyChangedEventListener

// static
XInputHierarchyChangedEventListener*
XInputHierarchyChangedEventListener::GetInstance() {
  NOTIMPLEMENTED();
  return new XInputHierarchyChangedEventListener();
}

XInputHierarchyChangedEventListener::XInputHierarchyChangedEventListener()
    : stopped_(false),
      xiopcode_(0) {
  NOTIMPLEMENTED();
}

XInputHierarchyChangedEventListener::~XInputHierarchyChangedEventListener() {
  NOTIMPLEMENTED();
}

void XInputHierarchyChangedEventListener::Stop() {
  NOTIMPLEMENTED();
}

base::EventStatus XInputHierarchyChangedEventListener::WillProcessEvent(
    const base::NativeEvent& event) {
  NOTIMPLEMENTED();
  return base::EVENT_HANDLED;
}

void XInputHierarchyChangedEventListener::DidProcessEvent(
    const base::NativeEvent& event) {
  NOTIMPLEMENTED();
}

bool XInputHierarchyChangedEventListener::ProcessedXEvent(XEvent* xevent) {
  NOTIMPLEMENTED();
  return true;
}

//////////////////////////////////////////////////////////////////////////////
// ScreenLocker

ScreenLocker::ScreenLocker(const UserManager::User& user) {
  NOTIMPLEMENTED();
}

ScreenLocker::~ScreenLocker() {
  NOTIMPLEMENTED();
}

void ScreenLocker::Init() {
  NOTIMPLEMENTED();
}

void ScreenLocker::OnLoginFailure(const LoginFailure& error) {
  NOTIMPLEMENTED();
}

void ScreenLocker::OnLoginSuccess(
    const std::string&,
    const std::string&,
    const GaiaAuthConsumer::ClientLoginResult&,
    bool,
    bool) {
  NOTIMPLEMENTED();
}

void ScreenLocker::Authenticate(const string16& password) {
  NOTIMPLEMENTED();
}

void ScreenLocker::ClearErrors() {
  NOTIMPLEMENTED();
}

void ScreenLocker::EnableInput() {
  NOTIMPLEMENTED();
}

void ScreenLocker::Signout() {
  NOTIMPLEMENTED();
}

void ScreenLocker::ShowCaptchaAndErrorMessage(const GURL& captcha_url,
                                              const string16& message) {
  NOTIMPLEMENTED();
}

void ScreenLocker::ShowErrorMessage(const string16& message,
                                    bool sign_out_only) {
  NOTIMPLEMENTED();
}

void ScreenLocker::SetLoginStatusConsumer(
    chromeos::LoginStatusConsumer* consumer) {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::Show() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::Hide() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::UnlockScreenFailed() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::InitClass() {
  NOTIMPLEMENTED();
}

void ScreenLocker::ScreenLockReady() {
  NOTIMPLEMENTED();
}

}  // namespace chromeos

class BalloonCollectionStub : public BalloonCollection {
 public:
  BalloonCollectionStub() {}
  virtual ~BalloonCollectionStub() {}
 private:
  void Add(const Notification& notification, Profile* profile) {}
  bool RemoveById(const std::string& id) { return true; }
  bool RemoveBySourceOrigin(const GURL& source_origin) { return true; }
  void RemoveAll() {}
  bool HasSpace() const { return true; }
  void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {}
  void SetPositionPreference(PositionPreference position) {}
  void DisplayChanged() {}
  void OnBalloonClosed(Balloon* source) {}
  const Balloons& GetActiveBalloons() { return balloons_; }

  Balloons balloons_;
};

// static
BalloonCollection* BalloonCollection::Create() {
  return new BalloonCollectionStub;
}
<commit_msg>[cros] Fix SystemNotification stubs for Aura.<commit_after>// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/notifications/system_notification.h"
#include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/notifications/balloon_collection.h"

namespace chromeos {

////////////////////////////////////////////////////////////////////////////////
// SystemNotification

void SystemNotification::Init(int icon_resource_id) {
  NOTIMPLEMENTED();
}

SystemNotification::SystemNotification(Profile* profile,
                                       NotificationDelegate* delegate,
                                       int icon_resource_id,
                                       const string16& title)
    : profile_(profile),
      collection_(NULL),
      delegate_(delegate),
      title_(title),
      visible_(false),
      urgent_(false) {
  NOTIMPLEMENTED();
}

SystemNotification::SystemNotification(Profile* profile,
                                       const std::string& id,
                                       int icon_resource_id,
                                       const string16& title)
    : profile_(profile),
      collection_(NULL),
      delegate_(new Delegate(id)),
      title_(title),
      visible_(false),
      urgent_(false) {
  NOTIMPLEMENTED();
}

SystemNotification::~SystemNotification() {
}

void SystemNotification::Show(const string16& message,
                              bool urgent,
                              bool sticky) {
  NOTIMPLEMENTED();
}

void SystemNotification::Show(const string16& message,
                              const string16& link,
                              const MessageCallback& callback,
                              bool urgent,
                              bool sticky) {
  NOTIMPLEMENTED();
}

void SystemNotification::Hide() {
  NOTIMPLEMENTED();
}

////////////////////////////////////////////////////////////////////////////////
// SystemNotification::Delegate

SystemNotification::Delegate::Delegate(const std::string& id)
    : id_(id) {
  NOTIMPLEMENTED();
}

std::string SystemNotification::Delegate::id() const {
  NOTIMPLEMENTED();
  return id_;
}

////////////////////////////////////////////////////////////////////////////////
// XInputHierarchyChangedEventListener

// static
XInputHierarchyChangedEventListener*
XInputHierarchyChangedEventListener::GetInstance() {
  NOTIMPLEMENTED();
  return new XInputHierarchyChangedEventListener();
}

XInputHierarchyChangedEventListener::XInputHierarchyChangedEventListener()
    : stopped_(false),
      xiopcode_(0) {
  NOTIMPLEMENTED();
}

XInputHierarchyChangedEventListener::~XInputHierarchyChangedEventListener() {
  NOTIMPLEMENTED();
}

void XInputHierarchyChangedEventListener::Stop() {
  NOTIMPLEMENTED();
}

base::EventStatus XInputHierarchyChangedEventListener::WillProcessEvent(
    const base::NativeEvent& event) {
  NOTIMPLEMENTED();
  return base::EVENT_HANDLED;
}

void XInputHierarchyChangedEventListener::DidProcessEvent(
    const base::NativeEvent& event) {
  NOTIMPLEMENTED();
}

bool XInputHierarchyChangedEventListener::ProcessedXEvent(XEvent* xevent) {
  NOTIMPLEMENTED();
  return true;
}

//////////////////////////////////////////////////////////////////////////////
// ScreenLocker

ScreenLocker::ScreenLocker(const UserManager::User& user) {
  NOTIMPLEMENTED();
}

ScreenLocker::~ScreenLocker() {
  NOTIMPLEMENTED();
}

void ScreenLocker::Init() {
  NOTIMPLEMENTED();
}

void ScreenLocker::OnLoginFailure(const LoginFailure& error) {
  NOTIMPLEMENTED();
}

void ScreenLocker::OnLoginSuccess(
    const std::string&,
    const std::string&,
    const GaiaAuthConsumer::ClientLoginResult&,
    bool,
    bool) {
  NOTIMPLEMENTED();
}

void ScreenLocker::Authenticate(const string16& password) {
  NOTIMPLEMENTED();
}

void ScreenLocker::ClearErrors() {
  NOTIMPLEMENTED();
}

void ScreenLocker::EnableInput() {
  NOTIMPLEMENTED();
}

void ScreenLocker::Signout() {
  NOTIMPLEMENTED();
}

void ScreenLocker::ShowCaptchaAndErrorMessage(const GURL& captcha_url,
                                              const string16& message) {
  NOTIMPLEMENTED();
}

void ScreenLocker::ShowErrorMessage(const string16& message,
                                    bool sign_out_only) {
  NOTIMPLEMENTED();
}

void ScreenLocker::SetLoginStatusConsumer(
    chromeos::LoginStatusConsumer* consumer) {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::Show() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::Hide() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::UnlockScreenFailed() {
  NOTIMPLEMENTED();
}

// static
void ScreenLocker::InitClass() {
  NOTIMPLEMENTED();
}

void ScreenLocker::ScreenLockReady() {
  NOTIMPLEMENTED();
}

}  // namespace chromeos

class BalloonCollectionStub : public BalloonCollection {
 public:
  BalloonCollectionStub() {}
  virtual ~BalloonCollectionStub() {}
 private:
  void Add(const Notification& notification, Profile* profile) {}
  bool RemoveById(const std::string& id) { return true; }
  bool RemoveBySourceOrigin(const GURL& source_origin) { return true; }
  void RemoveAll() {}
  bool HasSpace() const { return true; }
  void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {}
  void SetPositionPreference(PositionPreference position) {}
  void DisplayChanged() {}
  void OnBalloonClosed(Balloon* source) {}
  const Balloons& GetActiveBalloons() { return balloons_; }

  Balloons balloons_;
};

// static
BalloonCollection* BalloonCollection::Create() {
  return new BalloonCollectionStub;
}
<|endoftext|>


<commit_before>
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

// Interface header.
#include "rendertab.h"

// appleseed.studio headers.
#include "mainwindow/rendering/renderwidget.h"

// appleseed.renderer headers.
#include "renderer/api/frame.h"
#include "renderer/api/project.h"

// appleseed.foundation headers.
#include "foundation/image/canvasproperties.h"
#include "foundation/image/color.h"
#include "foundation/image/image.h"

// Qt headers.
#include <QComboBox>
#include <QGridLayout>
#include <QIcon>
#include <QLabel>
#include <QLayout>
#include <QScrollArea>
#include <QSize>
#include <QString>
#include <Qt>
#include <QToolBar>
#include <QToolButton>

using namespace foundation;
using namespace renderer;

namespace appleseed {
namespace studio {

//
// RenderTab class implementation.
//

RenderTab::RenderTab(
    ProjectExplorer&    project_explorer,
    Project&            project)
  : m_project_explorer(project_explorer)
  , m_project(project)
{
    create_render_widget();
    create_toolbar();
    create_scrollarea();

    setObjectName(QString::fromUtf8("render_widget_tab"));
    setLayout(new QGridLayout());
    layout()->setSpacing(0);
    layout()->setMargin(0);
    layout()->addWidget(m_toolbar);
    layout()->addWidget(m_scroll_area);

    recreate_handlers();
}

void RenderTab::clear()
{
    m_render_widget->clear(Color4f(0.0f));
    m_render_widget->repaint();
}

void RenderTab::darken()
{
    m_render_widget->multiply(0.2f);
}

void RenderTab::reset_zoom()
{
    m_zoom_handler->reset_zoom();
}

void RenderTab::update()
{
    m_render_widget->update();
}

void RenderTab::update_size()
{
    m_set_render_region_button->setChecked(false);

    const CanvasProperties& props = m_project.get_frame()->image().properties();

    m_render_widget->resize(
        props.m_canvas_width,
        props.m_canvas_height);

    recreate_handlers();
}

RenderWidget* RenderTab::get_render_widget() const
{
    return m_render_widget;
}

RenderTab::State RenderTab::save_state() const
{
    State state;
    state.m_zoom_handler_state = m_zoom_handler->save_state();
    state.m_pan_handler_state = m_pan_handler->save_state();
    return state;
}

void RenderTab::load_state(const State& state)
{
    // The order matters here.
    m_zoom_handler->load_state(state.m_zoom_handler_state);
    m_pan_handler->load_state(state.m_pan_handler_state);
}

void RenderTab::slot_render_widget_context_menu(const QPoint& point)
{
    emit signal_render_widget_context_menu(m_render_widget->mapToGlobal(point));
}

void RenderTab::slot_toggle_render_region(const bool checked)
{
    m_picking_handler->set_enabled(!checked);
    m_render_region_handler->set_enabled(checked);
}

void RenderTab::slot_set_render_region(const QRect& rect)
{
    m_set_render_region_button->setChecked(false);
    emit signal_set_render_region(rect);
}

void RenderTab::create_render_widget()
{
    const CanvasProperties& props = m_project.get_frame()->image().properties();

    m_render_widget =
        new RenderWidget(
            props.m_canvas_width,
            props.m_canvas_height);

    m_render_widget->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(
        m_render_widget, SIGNAL(customContextMenuRequested(const QPoint&)),
        SLOT(slot_render_widget_context_menu(const QPoint&)));

    m_render_widget->setMouseTracking(true);
}

void RenderTab::create_toolbar()
{
    // Create the render toolbar.
    m_toolbar = new QToolBar();
    m_toolbar->setObjectName(QString::fromUtf8("render_toolbar"));
    m_toolbar->setIconSize(QSize(18, 18));

    // Create the Save Image button in the render toolbar.
    m_save_aovs_button = new QToolButton();
    m_save_aovs_button->setIcon(QIcon(":/icons/save_image.png"));
    m_save_aovs_button->setToolTip("Save All AOVs...");
    connect(
        m_save_aovs_button, SIGNAL(clicked()),
        SIGNAL(signal_save_all_aovs()));
    m_toolbar->addWidget(m_save_aovs_button);

    // Create the Quick Save Image button in the render toolbar.
    m_quick_save_aovs_button = new QToolButton();
    m_quick_save_aovs_button->setIcon(QIcon(":/icons/quick_save_aovs.png"));
    m_quick_save_aovs_button->setToolTip("Quicksave All AOVs");
    connect(
        m_quick_save_aovs_button, SIGNAL(clicked()),
        SIGNAL(signal_quicksave_all_aovs()));
    m_toolbar->addWidget(m_quick_save_aovs_button);

    m_toolbar->addSeparator();

    // Create the Set Render Region button in the render toolbar.
    m_set_render_region_button = new QToolButton();
    m_set_render_region_button->setIcon(QIcon(":/icons/selection-blue.png"));
    m_set_render_region_button->setToolTip("Set Render Region");
    m_set_render_region_button->setShortcut(Qt::Key_R);
    m_set_render_region_button->setCheckable(true);
    connect(
        m_set_render_region_button, SIGNAL(toggled(bool)),
        SLOT(slot_toggle_render_region(const bool)));
    m_toolbar->addWidget(m_set_render_region_button);

    // Create the Clear Render Region button in the render toolbar.
    m_clear_render_region_button = new QToolButton();
    m_clear_render_region_button->setIcon(QIcon(":/icons/selection-crossed.png"));
    m_clear_render_region_button->setToolTip("Clear Render Region");
    m_clear_render_region_button->setShortcut(Qt::Key_C);
    connect(
        m_clear_render_region_button, SIGNAL(clicked()),
        SIGNAL(signal_clear_render_region()));
    m_toolbar->addWidget(m_clear_render_region_button);

    // Create the Clear Frame button in the render toolbar.
    m_clear_frame_button = new QToolButton();
    m_clear_frame_button->setIcon(QIcon(":/icons/picture_empty.png"));
    m_clear_frame_button->setToolTip("Clear Frame");
    m_clear_frame_button->setShortcut(Qt::Key_X);
    connect(
        m_clear_frame_button, SIGNAL(clicked()),
        SIGNAL(signal_clear_frame()));
    m_toolbar->addWidget(m_clear_frame_button);

    m_toolbar->addSeparator();

    // Create the Reset Zoom button in the render toolbar.
    m_reset_zoom_button = new QToolButton();
    m_reset_zoom_button->setIcon(QIcon(":/icons/reset_zoom.png"));
    m_reset_zoom_button->setToolTip("Reset Zoom");
    m_reset_zoom_button->setShortcut(Qt::Key_Asterisk);
    connect(
        m_reset_zoom_button, SIGNAL(clicked()),
        SIGNAL(signal_reset_zoom()));
    m_toolbar->addWidget(m_reset_zoom_button);

    m_toolbar->addSeparator();

    // Create the label preceding the picking mode combobox.
    QLabel* picking_mode_label = new QLabel("Picking Mode:");
    picking_mode_label->setObjectName(QString::fromUtf8("picking_mode_label"));
    m_toolbar->addWidget(picking_mode_label);

    // Create the picking mode combobox.
    // The combo will be populated by the ScenePickingHandler instantiated below.
    m_picking_mode_combo = new QComboBox();
    m_picking_mode_combo->setObjectName(QString::fromUtf8("picking_mode_combo"));
    m_toolbar->addWidget(m_picking_mode_combo);

    // Add stretchy spacer
    // This places interactive elements on the left and info to the right.
    m_spacer = new QWidget();
    m_spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_toolbar->addWidget(m_spacer);

    // Create a label to display various information such as mouse coordinates, etc.
    m_info_label = new QLabel();
    m_info_label->setScaledContents(true);
    m_info_label->setObjectName(QString::fromUtf8("info_label"));
    m_toolbar->addWidget(m_info_label);

    m_toolbar->addSeparator();

    // Create labels to display RGBA values.

    m_r_label = new QLabel();
    m_r_label->setScaledContents(true);
    m_r_label->setObjectName(QString::fromUtf8("r_label"));
    m_toolbar->addWidget(m_r_label);

    m_g_label = new QLabel();
    m_g_label->setScaledContents(true);
    m_g_label->setObjectName(QString::fromUtf8("g_label"));
    m_toolbar->addWidget(m_g_label);

    m_b_label = new QLabel();
    m_b_label->setScaledContents(true);
    m_b_label->setObjectName(QString::fromUtf8("b_label"));
    m_toolbar->addWidget(m_b_label);

    m_a_label = new QLabel();
    m_a_label->setScaledContents(true);
    m_a_label->setObjectName(QString::fromUtf8("a_label"));
    m_toolbar->addWidget(m_a_label);
}

void RenderTab::create_scrollarea()
{
    // Encapsulate the render widget into another widget that adds a margin around it.
    QWidget* render_widget_wrapper = new QWidget();
    render_widget_wrapper->setObjectName(QString::fromUtf8("render_widget_wrapper"));
    render_widget_wrapper->setLayout(new QGridLayout());
    render_widget_wrapper->layout()->setSizeConstraint(QLayout::SetFixedSize);
    render_widget_wrapper->layout()->setContentsMargins(20, 20, 20, 20);
    render_widget_wrapper->layout()->addWidget(m_render_widget);

    // Wrap the render widget in a scroll area.
    m_scroll_area = new QScrollArea();
    m_scroll_area->setObjectName(QString::fromUtf8("render_widget_scrollarea"));
    m_scroll_area->setAlignment(Qt::AlignCenter);
    m_scroll_area->setWidget(render_widget_wrapper);
}

void RenderTab::recreate_handlers()
{
    // Handler to handle zooming the render widget in and out with the keyboard or the mouse wheel.
    m_zoom_handler.reset(
        new WidgetZoomHandler(
            m_scroll_area,
            m_render_widget));

    // Handler for camera panning with the mouse.
    m_pan_handler.reset(
        new ScrollAreaPanHandler(
            m_scroll_area));

    // Handler for camera tracking with the mouse.
    m_mouse_tracker.reset(
        new MouseCoordinatesTracker(
            m_render_widget,
            m_info_label));

    // Handler for picking scene entities in the render widget.
    m_picking_handler.reset(
        new ScenePickingHandler(
            m_render_widget,
            m_picking_mode_combo,
            m_r_label,
            m_g_label,
            m_b_label,
            m_a_label,
            *m_mouse_tracker.get(),
            m_project_explorer,
            m_project));

    // Handler for defining render regions with the mouse.
    m_render_region_handler.reset(
        new RenderRegionHandler(
            m_render_widget,
            *m_mouse_tracker.get()));
    connect(
        m_render_region_handler.get(), SIGNAL(signal_render_region(const QRect&)),
        SLOT(slot_set_render_region(const QRect&)));

    // Clipboard handler.
    m_clipboard_handler.reset(new RenderClipboardHandler(m_render_widget));

    // Initially, the picking handler is active and the render region is inactive.
    m_picking_handler->set_enabled(true);
    m_render_region_handler->set_enabled(false);
}

void RenderTab::set_clear_frame_button_enabled(const bool enabled)
{
    m_clear_frame_button->setEnabled(enabled);
}

}   // namespace studio
}   // namespace appleseed

#include "mainwindow/rendering/moc_cpp_rendertab.cxx"
<commit_msg>cosmetics.<commit_after>
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

// Interface header.
#include "rendertab.h"

// appleseed.studio headers.
#include "mainwindow/rendering/renderwidget.h"

// appleseed.renderer headers.
#include "renderer/api/frame.h"
#include "renderer/api/project.h"

// appleseed.foundation headers.
#include "foundation/image/canvasproperties.h"
#include "foundation/image/color.h"
#include "foundation/image/image.h"

// Qt headers.
#include <QComboBox>
#include <QGridLayout>
#include <QIcon>
#include <QLabel>
#include <QLayout>
#include <QScrollArea>
#include <QSize>
#include <QString>
#include <Qt>
#include <QToolBar>
#include <QToolButton>

using namespace foundation;
using namespace renderer;

namespace appleseed {
namespace studio {

//
// RenderTab class implementation.
//

RenderTab::RenderTab(
    ProjectExplorer&    project_explorer,
    Project&            project)
  : m_project_explorer(project_explorer)
  , m_project(project)
{
    create_render_widget();
    create_toolbar();
    create_scrollarea();

    setObjectName(QString::fromUtf8("render_widget_tab"));
    setLayout(new QGridLayout());
    layout()->setSpacing(0);
    layout()->setMargin(0);
    layout()->addWidget(m_toolbar);
    layout()->addWidget(m_scroll_area);

    recreate_handlers();
}

void RenderTab::clear()
{
    m_render_widget->clear(Color4f(0.0f));
    m_render_widget->repaint();
}

void RenderTab::darken()
{
    m_render_widget->multiply(0.2f);
}

void RenderTab::reset_zoom()
{
    m_zoom_handler->reset_zoom();
}

void RenderTab::update()
{
    m_render_widget->update();
}

void RenderTab::update_size()
{
    m_set_render_region_button->setChecked(false);

    const CanvasProperties& props = m_project.get_frame()->image().properties();

    m_render_widget->resize(
        props.m_canvas_width,
        props.m_canvas_height);

    recreate_handlers();
}

RenderWidget* RenderTab::get_render_widget() const
{
    return m_render_widget;
}

RenderTab::State RenderTab::save_state() const
{
    State state;
    state.m_zoom_handler_state = m_zoom_handler->save_state();
    state.m_pan_handler_state = m_pan_handler->save_state();
    return state;
}

void RenderTab::load_state(const State& state)
{
    // The order matters here.
    m_zoom_handler->load_state(state.m_zoom_handler_state);
    m_pan_handler->load_state(state.m_pan_handler_state);
}

void RenderTab::slot_render_widget_context_menu(const QPoint& point)
{
    emit signal_render_widget_context_menu(m_render_widget->mapToGlobal(point));
}

void RenderTab::slot_toggle_render_region(const bool checked)
{
    m_picking_handler->set_enabled(!checked);
    m_render_region_handler->set_enabled(checked);
}

void RenderTab::slot_set_render_region(const QRect& rect)
{
    m_set_render_region_button->setChecked(false);
    emit signal_set_render_region(rect);
}

void RenderTab::create_render_widget()
{
    const CanvasProperties& props = m_project.get_frame()->image().properties();

    m_render_widget =
        new RenderWidget(
            props.m_canvas_width,
            props.m_canvas_height);

    m_render_widget->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(
        m_render_widget, SIGNAL(customContextMenuRequested(const QPoint&)),
        SLOT(slot_render_widget_context_menu(const QPoint&)));

    m_render_widget->setMouseTracking(true);
}

void RenderTab::create_toolbar()
{
    // Create the render toolbar.
    m_toolbar = new QToolBar();
    m_toolbar->setObjectName(QString::fromUtf8("render_toolbar"));
    m_toolbar->setIconSize(QSize(18, 18));

    // Create the Save Image button in the render toolbar.
    m_save_aovs_button = new QToolButton();
    m_save_aovs_button->setIcon(QIcon(":/icons/save_image.png"));
    m_save_aovs_button->setToolTip("Save All AOVs...");
    connect(
        m_save_aovs_button, SIGNAL(clicked()),
        SIGNAL(signal_save_all_aovs()));
    m_toolbar->addWidget(m_save_aovs_button);

    // Create the Quick Save Image button in the render toolbar.
    m_quick_save_aovs_button = new QToolButton();
    m_quick_save_aovs_button->setIcon(QIcon(":/icons/quick_save_aovs.png"));
    m_quick_save_aovs_button->setToolTip("Quicksave All AOVs");
    connect(
        m_quick_save_aovs_button, SIGNAL(clicked()),
        SIGNAL(signal_quicksave_all_aovs()));
    m_toolbar->addWidget(m_quick_save_aovs_button);

    m_toolbar->addSeparator();

    // Create the Set Render Region button in the render toolbar.
    m_set_render_region_button = new QToolButton();
    m_set_render_region_button->setIcon(QIcon(":/icons/selection-blue.png"));
    m_set_render_region_button->setToolTip("Set Render Region");
    m_set_render_region_button->setShortcut(Qt::Key_R);
    m_set_render_region_button->setCheckable(true);
    connect(
        m_set_render_region_button, SIGNAL(toggled(bool)),
        SLOT(slot_toggle_render_region(const bool)));
    m_toolbar->addWidget(m_set_render_region_button);

    // Create the Clear Render Region button in the render toolbar.
    m_clear_render_region_button = new QToolButton();
    m_clear_render_region_button->setIcon(QIcon(":/icons/selection-crossed.png"));
    m_clear_render_region_button->setToolTip("Clear Render Region");
    m_clear_render_region_button->setShortcut(Qt::Key_C);
    connect(
        m_clear_render_region_button, SIGNAL(clicked()),
        SIGNAL(signal_clear_render_region()));
    m_toolbar->addWidget(m_clear_render_region_button);

    // Create the Clear Frame button in the render toolbar.
    m_clear_frame_button = new QToolButton();
    m_clear_frame_button->setIcon(QIcon(":/icons/picture_empty.png"));
    m_clear_frame_button->setToolTip("Clear Frame");
    m_clear_frame_button->setShortcut(Qt::Key_X);
    connect(
        m_clear_frame_button, SIGNAL(clicked()),
        SIGNAL(signal_clear_frame()));
    m_toolbar->addWidget(m_clear_frame_button);

    m_toolbar->addSeparator();

    // Create the Reset Zoom button in the render toolbar.
    m_reset_zoom_button = new QToolButton();
    m_reset_zoom_button->setIcon(QIcon(":/icons/reset_zoom.png"));
    m_reset_zoom_button->setToolTip("Reset Zoom");
    m_reset_zoom_button->setShortcut(Qt::Key_Asterisk);
    connect(
        m_reset_zoom_button, SIGNAL(clicked()),
        SIGNAL(signal_reset_zoom()));
    m_toolbar->addWidget(m_reset_zoom_button);

    m_toolbar->addSeparator();

    // Create the label preceding the picking mode combobox.
    QLabel* picking_mode_label = new QLabel("Picking Mode:");
    picking_mode_label->setObjectName(QString::fromUtf8("picking_mode_label"));
    m_toolbar->addWidget(picking_mode_label);

    // Create the picking mode combobox.
    // The combo will be populated by the ScenePickingHandler instantiated below.
    m_picking_mode_combo = new QComboBox();
    m_picking_mode_combo->setObjectName(QString::fromUtf8("picking_mode_combo"));
    m_toolbar->addWidget(m_picking_mode_combo);

    // Add stretchy spacer.
    // This places interactive elements on the left and info to the right.
    m_spacer = new QWidget();
    m_spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_toolbar->addWidget(m_spacer);

    // Create a label to display various information such as mouse coordinates, etc.
    m_info_label = new QLabel();
    m_info_label->setScaledContents(true);
    m_info_label->setObjectName(QString::fromUtf8("info_label"));
    m_toolbar->addWidget(m_info_label);

    m_toolbar->addSeparator();

    // Create labels to display RGBA values.

    m_r_label = new QLabel();
    m_r_label->setScaledContents(true);
    m_r_label->setObjectName(QString::fromUtf8("r_label"));
    m_toolbar->addWidget(m_r_label);

    m_g_label = new QLabel();
    m_g_label->setScaledContents(true);
    m_g_label->setObjectName(QString::fromUtf8("g_label"));
    m_toolbar->addWidget(m_g_label);

    m_b_label = new QLabel();
    m_b_label->setScaledContents(true);
    m_b_label->setObjectName(QString::fromUtf8("b_label"));
    m_toolbar->addWidget(m_b_label);

    m_a_label = new QLabel();
    m_a_label->setScaledContents(true);
    m_a_label->setObjectName(QString::fromUtf8("a_label"));
    m_toolbar->addWidget(m_a_label);
}

void RenderTab::create_scrollarea()
{
    // Encapsulate the render widget into another widget that adds a margin around it.
    QWidget* render_widget_wrapper = new QWidget();
    render_widget_wrapper->setObjectName(QString::fromUtf8("render_widget_wrapper"));
    render_widget_wrapper->setLayout(new QGridLayout());
    render_widget_wrapper->layout()->setSizeConstraint(QLayout::SetFixedSize);
    render_widget_wrapper->layout()->setContentsMargins(20, 20, 20, 20);
    render_widget_wrapper->layout()->addWidget(m_render_widget);

    // Wrap the render widget in a scroll area.
    m_scroll_area = new QScrollArea();
    m_scroll_area->setObjectName(QString::fromUtf8("render_widget_scrollarea"));
    m_scroll_area->setAlignment(Qt::AlignCenter);
    m_scroll_area->setWidget(render_widget_wrapper);
}

void RenderTab::recreate_handlers()
{
    // Handler to handle zooming the render widget in and out with the keyboard or the mouse wheel.
    m_zoom_handler.reset(
        new WidgetZoomHandler(
            m_scroll_area,
            m_render_widget));

    // Handler for camera panning with the mouse.
    m_pan_handler.reset(
        new ScrollAreaPanHandler(
            m_scroll_area));

    // Handler for camera tracking with the mouse.
    m_mouse_tracker.reset(
        new MouseCoordinatesTracker(
            m_render_widget,
            m_info_label));

    // Handler for picking scene entities in the render widget.
    m_picking_handler.reset(
        new ScenePickingHandler(
            m_render_widget,
            m_picking_mode_combo,
            m_r_label,
            m_g_label,
            m_b_label,
            m_a_label,
            *m_mouse_tracker.get(),
            m_project_explorer,
            m_project));

    // Handler for defining render regions with the mouse.
    m_render_region_handler.reset(
        new RenderRegionHandler(
            m_render_widget,
            *m_mouse_tracker.get()));
    connect(
        m_render_region_handler.get(), SIGNAL(signal_render_region(const QRect&)),
        SLOT(slot_set_render_region(const QRect&)));

    // Clipboard handler.
    m_clipboard_handler.reset(new RenderClipboardHandler(m_render_widget));

    // Initially, the picking handler is active and the render region is inactive.
    m_picking_handler->set_enabled(true);
    m_render_region_handler->set_enabled(false);
}

void RenderTab::set_clear_frame_button_enabled(const bool enabled)
{
    m_clear_frame_button->setEnabled(enabled);
}

}   // namespace studio
}   // namespace appleseed

#include "mainwindow/rendering/moc_cpp_rendertab.cxx"
<|endoftext|>


<commit_before>/*
 * Copyright (C) Alex Nekipelov (alex@nekipelov.net)
 * License: MIT
 */

#ifndef REDISASYNCCLIENT_REDISASYNCCLIENT_CPP
#define REDISASYNCCLIENT_REDISASYNCCLIENT_CPP

#include <memory>
#include <functional>

#include "redisclient/impl/throwerror.h"
#include "redisclient/redisasyncclient.h"

namespace redisclient {

RedisAsyncClient::RedisAsyncClient(boost::asio::io_service &ioService)
    : pimpl(std::make_shared<RedisClientImpl>(ioService))
{
    pimpl->errorHandler = std::bind(&RedisClientImpl::defaulErrorHandler, std::placeholders::_1);
}

RedisAsyncClient::~RedisAsyncClient()
{
    pimpl->close();
}

void RedisAsyncClient::connect(const boost::asio::ip::tcp::endpoint &endpoint,
                               std::function<void(boost::system::error_code)> handler)
{
    if( pimpl->state == State::Closed )
    {
        pimpl->redisParser = RedisParser();
        std::move(pimpl->socket);
    }

    if( pimpl->state == State::Unconnected || pimpl->state == State::Closed )
    {
        pimpl->state = State::Connecting;
        pimpl->socket.async_connect(endpoint, std::bind(&RedisClientImpl::handleAsyncConnect,
                    pimpl, std::placeholders::_1, std::move(handler)));
    }
    else
    {
        // FIXME: add correct error message
        //std::stringstream ss;
        //ss << "RedisAsyncClient::connect called on socket with state " << to_string(pimpl->state);
        //handler(false, ss.str());
        handler(boost::system::error_code());
    }
}

#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS

void RedisAsyncClient::connect(const boost::asio::local::stream_protocol::endpoint &endpoint,
                               std::function<void(boost::system::error_code)> handler)
{
    if( pimpl->state == State::Unconnected || pimpl->state == State::Closed )
    {
        pimpl->state = State::Connecting;
        pimpl->socket.async_connect(endpoint, std::bind(&RedisClientImpl::handleAsyncConnect,
                    pimpl, std::placeholders::_1, std::move(handler)));
    }
    else
    {
        // FIXME: add correct error message
        //std::stringstream ss;
        //ss << "RedisAsyncClient::connect called on socket with state " << to_string(pimpl->state);
        //handler(false, ss.str());
        handler(boost::system::error_code());
    }
}

#endif

bool RedisAsyncClient::isConnected() const
{
    return pimpl->getState() == State::Connected ||
            pimpl->getState() == State::Subscribed;
}

void RedisAsyncClient::disconnect()
{
    pimpl->close();
}

void RedisAsyncClient::installErrorHandler(std::function<void(const std::string &)> handler)
{
    pimpl->errorHandler = std::move(handler);
}

void RedisAsyncClient::command(const std::string &cmd, std::deque<RedisBuffer> args,
                          std::function<void(RedisValue)> handler)
{
    if(stateValid())
    {
        args.emplace_front(cmd);

        pimpl->post(std::bind(&RedisClientImpl::doAsyncCommand, pimpl,
                    std::move(pimpl->makeCommand(args)), std::move(handler)));
    }
}

RedisAsyncClient::Handle RedisAsyncClient::subscribe(
        const std::string &channel,
        std::function<void(std::vector<char> msg)> msgHandler,
        std::function<void(RedisValue)> handler)
{
    auto handleId = pimpl->subscribe("subscribe", channel, msgHandler, handler);
    return { handleId , channel };
}

RedisAsyncClient::Handle RedisAsyncClient::psubscribe(
    const std::string &pattern,
    std::function<void(std::vector<char> msg)> msgHandler,
    std::function<void(RedisValue)> handler)
{
    auto handleId = pimpl->subscribe("psubscribe", pattern, msgHandler, handler);
    return{ handleId , pattern };
}

void RedisAsyncClient::unsubscribe(const Handle &handle)
{
    pimpl->unsubscribe("unsubscribe", handle.id, handle.channel, dummyHandler);
}

void RedisAsyncClient::punsubscribe(const Handle &handle)
{
    pimpl->unsubscribe("punsubscribe", handle.id, handle.channel, dummyHandler);
}

void RedisAsyncClient::singleShotSubscribe(const std::string &channel,
                                           std::function<void(std::vector<char> msg)> msgHandler,
                                           std::function<void(RedisValue)> handler)
{
    pimpl->singleShotSubscribe("subscribe", channel, msgHandler, handler);
}

void RedisAsyncClient::singleShotPSubscribe(const std::string &pattern,
    std::function<void(std::vector<char> msg)> msgHandler,
    std::function<void(RedisValue)> handler)
{
    pimpl->singleShotSubscribe("psubscribe", pattern, msgHandler, handler);
}

void RedisAsyncClient::publish(const std::string &channel, const RedisBuffer &msg,
                          std::function<void(RedisValue)> handler)
{
    assert( pimpl->state == State::Connected );

    static const std::string publishStr = "PUBLISH";

    if( pimpl->state == State::Connected )
    {
        std::deque<RedisBuffer> items(3);

        items[0] = publishStr;
        items[1] = channel;
        items[2] = msg;

        pimpl->post(std::bind(&RedisClientImpl::doAsyncCommand, pimpl,
                    pimpl->makeCommand(items), std::move(handler)));
    }
    else
    {
        std::stringstream ss;

        ss << "RedisAsyncClient::command called with invalid state "
           << to_string(pimpl->state);

        pimpl->errorHandler(ss.str());
    }
}

RedisAsyncClient::State RedisAsyncClient::state() const
{
    return pimpl->getState();
}

bool RedisAsyncClient::stateValid() const
{
    assert( pimpl->state == State::Connected );

    if( pimpl->state != State::Connected )
    {
        std::stringstream ss;

        ss << "RedisAsyncClient::command called with invalid state "
           << to_string(pimpl->state);

        pimpl->errorHandler(ss.str());
        return false;
    }

    return true;
}

}

#endif // REDISASYNCCLIENT_REDISASYNCCLIENT_CPP
<commit_msg>Fix moving a temporary object prevents copy elision. (#68)<commit_after>/*
 * Copyright (C) Alex Nekipelov (alex@nekipelov.net)
 * License: MIT
 */

#ifndef REDISASYNCCLIENT_REDISASYNCCLIENT_CPP
#define REDISASYNCCLIENT_REDISASYNCCLIENT_CPP

#include <memory>
#include <functional>

#include "redisclient/impl/throwerror.h"
#include "redisclient/redisasyncclient.h"

namespace redisclient {

RedisAsyncClient::RedisAsyncClient(boost::asio::io_service &ioService)
    : pimpl(std::make_shared<RedisClientImpl>(ioService))
{
    pimpl->errorHandler = std::bind(&RedisClientImpl::defaulErrorHandler, std::placeholders::_1);
}

RedisAsyncClient::~RedisAsyncClient()
{
    pimpl->close();
}

void RedisAsyncClient::connect(const boost::asio::ip::tcp::endpoint &endpoint,
                               std::function<void(boost::system::error_code)> handler)
{
    if( pimpl->state == State::Closed )
    {
        pimpl->redisParser = RedisParser();
        std::move(pimpl->socket);
    }

    if( pimpl->state == State::Unconnected || pimpl->state == State::Closed )
    {
        pimpl->state = State::Connecting;
        pimpl->socket.async_connect(endpoint, std::bind(&RedisClientImpl::handleAsyncConnect,
                    pimpl, std::placeholders::_1, std::move(handler)));
    }
    else
    {
        // FIXME: add correct error message
        //std::stringstream ss;
        //ss << "RedisAsyncClient::connect called on socket with state " << to_string(pimpl->state);
        //handler(false, ss.str());
        handler(boost::system::error_code());
    }
}

#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS

void RedisAsyncClient::connect(const boost::asio::local::stream_protocol::endpoint &endpoint,
                               std::function<void(boost::system::error_code)> handler)
{
    if( pimpl->state == State::Unconnected || pimpl->state == State::Closed )
    {
        pimpl->state = State::Connecting;
        pimpl->socket.async_connect(endpoint, std::bind(&RedisClientImpl::handleAsyncConnect,
                    pimpl, std::placeholders::_1, std::move(handler)));
    }
    else
    {
        // FIXME: add correct error message
        //std::stringstream ss;
        //ss << "RedisAsyncClient::connect called on socket with state " << to_string(pimpl->state);
        //handler(false, ss.str());
        handler(boost::system::error_code());
    }
}

#endif

bool RedisAsyncClient::isConnected() const
{
    return pimpl->getState() == State::Connected ||
            pimpl->getState() == State::Subscribed;
}

void RedisAsyncClient::disconnect()
{
    pimpl->close();
}

void RedisAsyncClient::installErrorHandler(std::function<void(const std::string &)> handler)
{
    pimpl->errorHandler = std::move(handler);
}

void RedisAsyncClient::command(const std::string &cmd, std::deque<RedisBuffer> args,
                          std::function<void(RedisValue)> handler)
{
    if(stateValid())
    {
        args.emplace_front(cmd);

        pimpl->post(std::bind(&RedisClientImpl::doAsyncCommand, pimpl,
                    pimpl->makeCommand(args), std::move(handler)));
    }
}

RedisAsyncClient::Handle RedisAsyncClient::subscribe(
        const std::string &channel,
        std::function<void(std::vector<char> msg)> msgHandler,
        std::function<void(RedisValue)> handler)
{
    auto handleId = pimpl->subscribe("subscribe", channel, msgHandler, handler);
    return { handleId , channel };
}

RedisAsyncClient::Handle RedisAsyncClient::psubscribe(
    const std::string &pattern,
    std::function<void(std::vector<char> msg)> msgHandler,
    std::function<void(RedisValue)> handler)
{
    auto handleId = pimpl->subscribe("psubscribe", pattern, msgHandler, handler);
    return{ handleId , pattern };
}

void RedisAsyncClient::unsubscribe(const Handle &handle)
{
    pimpl->unsubscribe("unsubscribe", handle.id, handle.channel, dummyHandler);
}

void RedisAsyncClient::punsubscribe(const Handle &handle)
{
    pimpl->unsubscribe("punsubscribe", handle.id, handle.channel, dummyHandler);
}

void RedisAsyncClient::singleShotSubscribe(const std::string &channel,
                                           std::function<void(std::vector<char> msg)> msgHandler,
                                           std::function<void(RedisValue)> handler)
{
    pimpl->singleShotSubscribe("subscribe", channel, msgHandler, handler);
}

void RedisAsyncClient::singleShotPSubscribe(const std::string &pattern,
    std::function<void(std::vector<char> msg)> msgHandler,
    std::function<void(RedisValue)> handler)
{
    pimpl->singleShotSubscribe("psubscribe", pattern, msgHandler, handler);
}

void RedisAsyncClient::publish(const std::string &channel, const RedisBuffer &msg,
                          std::function<void(RedisValue)> handler)
{
    assert( pimpl->state == State::Connected );

    static const std::string publishStr = "PUBLISH";

    if( pimpl->state == State::Connected )
    {
        std::deque<RedisBuffer> items(3);

        items[0] = publishStr;
        items[1] = channel;
        items[2] = msg;

        pimpl->post(std::bind(&RedisClientImpl::doAsyncCommand, pimpl,
                    pimpl->makeCommand(items), std::move(handler)));
    }
    else
    {
        std::stringstream ss;

        ss << "RedisAsyncClient::command called with invalid state "
           << to_string(pimpl->state);

        pimpl->errorHandler(ss.str());
    }
}

RedisAsyncClient::State RedisAsyncClient::state() const
{
    return pimpl->getState();
}

bool RedisAsyncClient::stateValid() const
{
    assert( pimpl->state == State::Connected );

    if( pimpl->state != State::Connected )
    {
        std::stringstream ss;

        ss << "RedisAsyncClient::command called with invalid state "
           << to_string(pimpl->state);

        pimpl->errorHandler(ss.str());
        return false;
    }

    return true;
}

}

#endif // REDISASYNCCLIENT_REDISASYNCCLIENT_CPP
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: fmtfsize.hxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: hr $ $Date: 2004-02-02 17:56:18 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _FMTFSIZE_HXX
#define _FMTFSIZE_HXX

#ifndef _GEN_HXX //autogen
#include <tools/gen.hxx>
#endif
#ifndef _SFXPOOLITEM_HXX //autogen
#include <svtools/poolitem.hxx>
#endif
#ifndef _HINTIDS_HXX
#include <hintids.hxx>
#endif
#ifndef _SWTYPES_HXX //autogen
#include <swtypes.hxx>
#endif
#ifndef _FORMAT_HXX //autogen
#include <format.hxx>
#endif

class IntlWrapper;

//Die Framesize ---------------------------------

enum SwFrmSize
{
    ATT_VAR_SIZE,       //Frm ist in der Var-Richtung variabel
    ATT_FIX_SIZE,       //Frm ist in der Var-Richtung unbeweglich
    ATT_MIN_SIZE        //Der Wert in der Var-Richtung beschreibt eine
                        //Minimalgroesse, die nicht unter- wohl aber
                        //ueberschritten werden kann.
};

class SwFmtFrmSize: public SfxPoolItem
{
    Size      aSize;
    SwFrmSize eFrmSize;
    BYTE      nWidthPercent;    //Fuer Tabellen kann die Breite in Prozent
    BYTE      nHeightPercent;   //angegeben sein.
                                //Fuer Rahmen koennen Hoehe und/oder Breite
                                //in Prozent angegeben sein. Wenn nur eine
                                //der Angaben in Prozent angeben ist, kann
                                //durch den ausgezeichneten Wert 0xFF in der
                                //anderen Prozentangabe bestimmt werden, das
                                //sich diese Richtung proportional zur anderen
                                //verhaelt. Basis fuer die Umrechnung sind fuer
                                //diesen Fall die Angaben in der Size.
                                //Die Prozentwerte beziehen sich immer auf die
                                //Umgebung in der das Objekt steht (PrtArea)
                                //Auf die Bildschirmbreite abzueglich Raender
                                //in der BrowseView wenn die Umgebung die Seite
                                //ist.
public:
    SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
                  SwTwips nWidth = 0, SwTwips nHeight = 0 );
    SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );

    // "pure virtual Methoden" vom SfxPoolItem
    virtual int             operator==( const SfxPoolItem& ) const;
    virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
    virtual SfxPoolItem*    Create(SvStream &, USHORT nVer) const;
    virtual SvStream&       Store(SvStream &, USHORT nIVer ) const;
    virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
                                    SfxMapUnit eCoreMetric,
                                    SfxMapUnit ePresMetric,
                                    String &rText,
                                    const IntlWrapper*    pIntl = 0 ) const;
    virtual BOOL             QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
    virtual BOOL             PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
    virtual USHORT           GetVersion( USHORT nFFVer ) const;

    SwFrmSize GetSizeType() const { return eFrmSize; }
    void SetSizeType( SwFrmSize eSize ) { eFrmSize = eSize; }

    const Size& GetSize() const { return aSize; }
          void  SetSize( const Size &rNew ) { aSize = rNew; }

    SwTwips GetHeight() const { return aSize.Height(); }
    SwTwips GetWidth()  const { return aSize.Width();  }
    void    SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
    void    SetWidth ( const SwTwips nNew ) { aSize.Width()  = nNew; }

    BYTE    GetHeightPercent() const{ return nHeightPercent; }
    BYTE    GetWidthPercent() const { return nWidthPercent;  }
    void    SetHeightPercent( BYTE n ) { nHeightPercent = n; }
    void    SetWidthPercent ( BYTE n ) { nWidthPercent  = n; }

    // Umrechnung der Groesse zwischen SW31/SW40
    Size    GetSizeConvertedToSw31( const SvxLRSpaceItem *pLRSpace,
                                    const SvxULSpaceItem *pULSpace ) const;
    Size    GetSizeConvertedFromSw31( const SvxLRSpaceItem *pLRSpace,
                                      const SvxULSpaceItem *pULSpace ) const;
};

inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(BOOL bInP) const
    { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }

inline const SwFmtFrmSize &SwFmt::GetFrmSize(BOOL bInP) const
    { return aSet.GetFrmSize(bInP); }

#endif

<commit_msg>INTEGRATION: CWS swautowidth (1.7.130); FILE MERGED 2004/04/05 13:08:30 fme 1.7.130.1: i27205# Feature - Automatic frame width<commit_after>/*************************************************************************
 *
 *  $RCSfile: fmtfsize.hxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: kz $ $Date: 2004-05-18 14:48:10 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _FMTFSIZE_HXX
#define _FMTFSIZE_HXX

#ifndef _GEN_HXX //autogen
#include <tools/gen.hxx>
#endif
#ifndef _SFXPOOLITEM_HXX //autogen
#include <svtools/poolitem.hxx>
#endif
#ifndef _HINTIDS_HXX
#include <hintids.hxx>
#endif
#ifndef _SWTYPES_HXX //autogen
#include <swtypes.hxx>
#endif
#ifndef _FORMAT_HXX //autogen
#include <format.hxx>
#endif

class IntlWrapper;

//Die Framesize ---------------------------------

enum SwFrmSize
{
    ATT_VAR_SIZE,       //Frm ist in der Var-Richtung variabel
    ATT_FIX_SIZE,       //Frm ist in der Var-Richtung unbeweglich
    ATT_MIN_SIZE        //Der Wert in der Var-Richtung beschreibt eine
                        //Minimalgroesse, die nicht unter- wohl aber
                        //ueberschritten werden kann.
};

class SwFmtFrmSize: public SfxPoolItem
{
    Size      aSize;
    SwFrmSize eFrmHeightType;
    SwFrmSize eFrmWidthType;
    BYTE      nWidthPercent;    //Fuer Tabellen kann die Breite in Prozent
    BYTE      nHeightPercent;   //angegeben sein.
                                //Fuer Rahmen koennen Hoehe und/oder Breite
                                //in Prozent angegeben sein. Wenn nur eine
                                //der Angaben in Prozent angeben ist, kann
                                //durch den ausgezeichneten Wert 0xFF in der
                                //anderen Prozentangabe bestimmt werden, das
                                //sich diese Richtung proportional zur anderen
                                //verhaelt. Basis fuer die Umrechnung sind fuer
                                //diesen Fall die Angaben in der Size.
                                //Die Prozentwerte beziehen sich immer auf die
                                //Umgebung in der das Objekt steht (PrtArea)
                                //Auf die Bildschirmbreite abzueglich Raender
                                //in der BrowseView wenn die Umgebung die Seite
                                //ist.
public:
    SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
                  SwTwips nWidth = 0, SwTwips nHeight = 0 );
    SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );

    // "pure virtual Methoden" vom SfxPoolItem
    virtual int             operator==( const SfxPoolItem& ) const;
    virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
    virtual SfxPoolItem*    Create(SvStream &, USHORT nVer) const;
    virtual SvStream&       Store(SvStream &, USHORT nIVer ) const;
    virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
                                    SfxMapUnit eCoreMetric,
                                    SfxMapUnit ePresMetric,
                                    String &rText,
                                    const IntlWrapper*    pIntl = 0 ) const;
    virtual BOOL             QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
    virtual BOOL             PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
    virtual USHORT           GetVersion( USHORT nFFVer ) const;

    SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
    void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }

    SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
    void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }

    const Size& GetSize() const { return aSize; }
          void  SetSize( const Size &rNew ) { aSize = rNew; }

    SwTwips GetHeight() const { return aSize.Height(); }
    SwTwips GetWidth()  const { return aSize.Width();  }
    void    SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
    void    SetWidth ( const SwTwips nNew ) { aSize.Width()  = nNew; }

    BYTE    GetHeightPercent() const{ return nHeightPercent; }
    BYTE    GetWidthPercent() const { return nWidthPercent;  }
    void    SetHeightPercent( BYTE n ) { nHeightPercent = n; }
    void    SetWidthPercent ( BYTE n ) { nWidthPercent  = n; }

    // Umrechnung der Groesse zwischen SW31/SW40
    Size    GetSizeConvertedToSw31( const SvxLRSpaceItem *pLRSpace,
                                    const SvxULSpaceItem *pULSpace ) const;
    Size    GetSizeConvertedFromSw31( const SvxLRSpaceItem *pLRSpace,
                                      const SvxULSpaceItem *pULSpace ) const;
};

inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(BOOL bInP) const
    { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }

inline const SwFmtFrmSize &SwFmt::GetFrmSize(BOOL bInP) const
    { return aSet.GetFrmSize(bInP); }

#endif

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: itabenum.hxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: rt $ $Date: 2004-05-03 13:42:19 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _ITABENUM_HXX
#define _ITABENUM_HXX

namespace tabopts
{
    const USHORT DEFAULT_BORDER     = 0x01;
    const USHORT HEADLINE           = 0x02;
//    const USHORT REPEAT             = 0x04;
//    const USHORT HEADLINE_REPEAT    = 0x06;  // Headline + Repeat
    const USHORT SPLIT_LAYOUT       = 0x08;
    const USHORT HEADLINE_NO_BORDER = HEADLINE | SPLIT_LAYOUT;
    const USHORT ALL_TBL_INS_ATTR   = DEFAULT_BORDER | HEADLINE | SPLIT_LAYOUT;
};

struct SwInsertTableOptions
{
    USHORT mnInsMode;
    USHORT mnRowsToRepeat;

    SwInsertTableOptions( USHORT nInsMode, USHORT nRowsToRepeat ) :
        mnInsMode( nInsMode ), mnRowsToRepeat( nRowsToRepeat ) {};
};

#endif

<commit_msg>INTEGRATION: CWS ooo19126 (1.2.732); FILE MERGED 2005/09/05 13:36:16 rt 1.2.732.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: itabenum.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-09 01:59:44 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _ITABENUM_HXX
#define _ITABENUM_HXX

namespace tabopts
{
    const USHORT DEFAULT_BORDER     = 0x01;
    const USHORT HEADLINE           = 0x02;
//    const USHORT REPEAT             = 0x04;
//    const USHORT HEADLINE_REPEAT    = 0x06;  // Headline + Repeat
    const USHORT SPLIT_LAYOUT       = 0x08;
    const USHORT HEADLINE_NO_BORDER = HEADLINE | SPLIT_LAYOUT;
    const USHORT ALL_TBL_INS_ATTR   = DEFAULT_BORDER | HEADLINE | SPLIT_LAYOUT;
};

struct SwInsertTableOptions
{
    USHORT mnInsMode;
    USHORT mnRowsToRepeat;

    SwInsertTableOptions( USHORT nInsMode, USHORT nRowsToRepeat ) :
        mnInsMode( nInsMode ), mnRowsToRepeat( nRowsToRepeat ) {};
};

#endif

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: redlnaut.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-09 02:06:46 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _REDLNAUT_HXX
#define _REDLNAUT_HXX

#ifndef _STRING_HXX //autogen
#include <tools/string.hxx>
#endif
#ifndef _TOOLS_COLOR_HXX
#include <tools/color.hxx>
#endif

#include "swtypes.hxx"

class SfxItemSet;

class SwRedlineAuthor
{
    String sAuthor;
    Color aChgLineColor;
    SfxItemSet *pInsAttrSet, *pDelAttrSet, *pFmtAttrSet;
    SwHoriOrient eChgLineOrient;
    BYTE cDelChar;
public:
    SwRedlineAuthor( SwAttrPool& rPool, const String& );
    SwRedlineAuthor( const SwRedlineAuthor& );
    ~SwRedlineAuthor();

    SwRedlineAuthor& operator=( const SwRedlineAuthor& );

    const String& GetAuthor() const { return sAuthor; }

    SfxItemSet& GetInsAttrSet() const { return *pInsAttrSet; }
    SfxItemSet& GetDelAttrSet() const { return *pDelAttrSet; }
    SfxItemSet& GetFmtAttrSet() const { return *pFmtAttrSet; }

    const Color& GetChgLineColor() const { return aChgLineColor; }
    void SetChgLineColor( const Color& rCol ) { aChgLineColor = rCol; }

    SwHoriOrient GetChgLineOrient() const { return eChgLineOrient; }
    void SetChgLineOrient( SwHoriOrient eVal ) { eChgLineOrient = eVal; }

    BYTE GetDelChar() const { return cDelChar; }
    void SetDelChar( BYTE cCh = 0 ) { cDelChar = cCh; }
};

#endif
<commit_msg>INTEGRATION: CWS writercorehandoff (1.2.750); FILE MERGED 2005/09/13 11:50:21 tra 1.2.750.2: RESYNC: (1.2-1.3); FILE MERGED 2005/06/07 14:10:14 fme 1.2.750.1: #i50348# General cleanup - removed unused header files, functions, members, declarations etc.<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: redlnaut.hxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: hr $ $Date: 2006-08-14 15:30:35 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _REDLNAUT_HXX
#define _REDLNAUT_HXX

#ifndef _STRING_HXX //autogen
#include <tools/string.hxx>
#endif
#ifndef _TOOLS_COLOR_HXX
#include <tools/color.hxx>
#endif

#include "swtypes.hxx"

class SfxItemSet;

class SwRedlineAuthor
{
    String sAuthor;
    Color aChgLineColor;
    SfxItemSet *pInsAttrSet, *pDelAttrSet, *pFmtAttrSet;
    SwHoriOrient eChgLineOrient;
    BYTE cDelChar;
public:
    SwRedlineAuthor( SwAttrPool& rPool, const String& );
    SwRedlineAuthor( const SwRedlineAuthor& );
    ~SwRedlineAuthor();

    SwRedlineAuthor& operator=( const SwRedlineAuthor& );
};

#endif
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: swmodule.hxx,v $
 *
 *  $Revision: 1.22 $
 *
 *  last change: $Author: obo $ $Date: 2004-08-12 12:06:55 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _SWMODULE_HXX
#define _SWMODULE_HXX

#ifndef _LINK_HXX //autogen
#include <tools/link.hxx>
#endif
#ifndef _SFXMODULE_HXX //autogen
#include <sfx2/module.hxx>
#endif

#ifndef _SFXLSTNER_HXX //autogen
#include <svtools/lstner.hxx>
#endif
#ifndef SW_SWDLL_HXX
//#include <swdll.hxx>
#endif
#include "shellid.hxx"
#ifndef _STRING_HXX
#include <tools/string.hxx>
#endif
#ifndef _COM_SUN_STAR_LINGUISTIC2_XLINGUSERVICEEVENTLISTENER_HPP_
#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
#endif
#ifndef _VCL_FLDUNIT_HXX
#include <vcl/fldunit.hxx>
#endif

class SvStringsDtor;
class Color;
class AuthorCharAttr;
class SfxItemSet;
class SfxRequest;
class SfxErrorHandler;
class SwDBConfig;
class SwModuleOptions;
class SwMasterUsrPref;
class SwViewOption;
class SwView;
class SwWrtShell;
class SwPrintOptions;
class SwAutoFmtOpt;
class SwChapterNumRules;
class SwStdFontConfig;
class SwNavigationConfig;
class SwTransferable;
class SwToolbarConfigItem;
class SwAttrPool;
namespace svtools{ class ColorConfig;}
class SvtAccessibilityOptions;
class SvtCTLOptions;
class SvtUserOptions;
class SvtUndoOptions;

struct SwDBData;
#define VIEWOPT_DEST_VIEW       0
#define VIEWOPT_DEST_TEXT       1
#define VIEWOPT_DEST_WEB        2
#define VIEWOPT_DEST_VIEW_ONLY  3 //ViewOptions werden nur an der ::com::sun::star::sdbcx::View, nicht an der Appl. gesetzt

namespace com{ namespace sun{ namespace star{ namespace scanner{
    class XScannerManager;
}}}}

class SwModule: public SfxModule, public SfxListener
{
    String              sActAuthor;

    // ConfigItems
    SwModuleOptions*    pModuleConfig;
    SwMasterUsrPref*    pUsrPref;
    SwMasterUsrPref*    pWebUsrPref;
    SwPrintOptions*     pPrtOpt;
    SwPrintOptions*     pWebPrtOpt;
    SwChapterNumRules*  pChapterNumRules;
    SwStdFontConfig*    pStdFontConfig;
    SwNavigationConfig* pNavigationConfig;
    SwToolbarConfigItem*pToolbarConfig;     //fuer gestackte Toolbars, welche
    SwToolbarConfigItem*pWebToolbarConfig;  //war sichtbar?
    SwDBConfig*         pDBConfig;
    svtools::ColorConfig*   pColorConfig;
    SvtAccessibilityOptions* pAccessibilityOptions;
    SvtCTLOptions*      pCTLOptions;
    SvtUserOptions*     pUserOptions;
    SvtUndoOptions*     pUndoOptions;

    SfxErrorHandler*    pErrorHdl;

    SwAttrPool          *pAttrPool;

    // Die aktuelle View wird hier gehalten um nicht ueber
    // GetActiveView arbeiten zu muessen
    // Die View ist solange gueltig bis Sie im Activate
    // zerstoert oder ausgetauscht wird
    SwView*             pView;

    // Liste aller Redline-Autoren
    SvStringsDtor*      pAuthorNames;

    // DictionaryList listener to trigger spellchecking or hyphenation
    ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
    ::com::sun::star::uno::Reference<
        ::com::sun::star::scanner::XScannerManager >    m_xScannerManager;

    sal_Bool                bAuthorInitialised : 1;
    sal_Bool                bEmbeddedLoadSave : 1;

    virtual void    FillStatusBar( StatusBar& );

    // Hint abfangen fuer DocInfo
    virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );

protected:
    // Briefumschlaege, Etiketten
    void                InsertEnv(SfxRequest&);
    void                InsertLab(SfxRequest&, sal_Bool bLabel);

public:
    // public Data - used for internal Clipboard / Drag & Drop / XSelection
    SwTransferable  *pClipboard, *pDragDrop, *pXSelection;

    TYPEINFO();
    SFX_DECL_INTERFACE(SW_INTERFACE_MODULE);

    // dieser Ctor nur fuer SW-Dll
    SwModule( SfxObjectFactory* pFact,
                SfxObjectFactory* pWebFact,
                    SfxObjectFactory* pGlobalFact );

    ~SwModule();

    // View setzen nur fuer internen Gebrauch,
    // aus techn. Gruenden public
    //
    inline  void        SetView(SwView* pVw) { pView = pVw; }
    inline  SwView*     GetView() { return pView; }

    //Die Handler fuer die Slots
    void                StateOther(SfxItemSet &);   // andere
    void                StateViewOptions(SfxItemSet &);

    void                ExecOther(SfxRequest &);    // Felder, Formel ..
    void                ExecViewOptions(SfxRequest &);
    void                ExecWizzard(SfxRequest &);

    // Benutzereinstellungen modifizieren
    const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const;
    const SwViewOption* GetViewOption(sal_Bool bWeb);
    void                MakeUsrPref( SwViewOption &rToFill, sal_Bool bWeb ) const;
    void                ApplyUsrPref(const SwViewOption &, SwView*,
                                     sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
    void ApplyUserMetric( FieldUnit eMetric, BOOL bWeb );
    void ApplyFldUpdateFlags(sal_Int32 nFldFlags);
    void ApplyLinkMode(sal_Int32 nNewLinkMode);

    // ConfigItems erzeugen
    SwModuleOptions*    GetModuleConfig()       { return pModuleConfig;}
    SwPrintOptions*     GetPrtOptions(sal_Bool bWeb);
    SwChapterNumRules*  GetChapterNumRules();
    SwStdFontConfig*    GetStdFontConfig()      { return pStdFontConfig; }
    SwNavigationConfig* GetNavigationConfig();
    SwToolbarConfigItem*GetToolbarConfig()      { return pToolbarConfig;    }
    SwToolbarConfigItem*GetWebToolbarConfig()   { return pWebToolbarConfig; }
    SwDBConfig*         GetDBConfig();
    svtools::ColorConfig&   GetColorConfig();
    SvtAccessibilityOptions&    GetAccessibilityOptions();
    SvtCTLOptions&      GetCTLOptions();
    SvtUserOptions&     GetUserOptions();
    SvtUndoOptions&     GetUndoOptions();

    // Ueber Sichten iterieren
    static SwView*      GetFirstView();
    static SwView*      GetNextView(SwView*);

    sal_Bool IsEmbeddedLoadSave() const         { return bEmbeddedLoadSave; }
    void SetEmbeddedLoadSave( sal_Bool bFlag )  { bEmbeddedLoadSave = bFlag; }

    void ShowDBObj( SwView& rView, const SwDBData& rData, BOOL bOnlyIfAvailable = FALSE);

    // Tabellenmodi
    sal_Bool            IsInsTblFormatNum(sal_Bool bHTML) const;
    sal_Bool            IsInsTblChangeNumFormat(sal_Bool bHTML) const;
    sal_Bool            IsInsTblAlignNum(sal_Bool bHTML) const;

    // Redlining
    sal_uInt16          GetRedlineAuthor();
    const String&       GetRedlineAuthor(sal_uInt16 nPos);
    sal_uInt16          InsertRedlineAuthor(const String& rAuthor);

    void                GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
    void                GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
    void                GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);

    sal_uInt16              GetRedlineMarkPos();
    const Color&            GetRedlineMarkColor();

    // returne den definierten DocStat - WordDelimiter
    const String&       GetDocStatWordDelim() const;

    // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
    sal_uInt16 GetMetric( sal_Bool bWeb ) const;

    // Update-Stati durchreichen
    sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
    sal_uInt16 GetFldUpdateFlags( sal_Bool bWeb ) const;

    //virtuelle Methoden fuer den Optionendialog
    virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId );
    virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
    virtual SfxTabPage*  CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );

    //hier wird der Pool angelegt und an der SfxShell gesetzt
    void    InitAttrPool();
    //Pool loeschen bevor es zu spaet ist
    void    RemoveAttrPool();

    // Invalidiert ggf. OnlineSpell-WrongListen
    void    CheckSpellChanges( sal_Bool bOnlineSpelling,
                    sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain );

    inline ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener >
            GetLngSvcEvtListener();
    inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
    void    CreateLngSvcEvtListener();

    ::com::sun::star::uno::Reference<
        ::com::sun::star::scanner::XScannerManager >
            GetScannerManager() const {return m_xScannerManager;}
};

inline ::com::sun::star::uno::Reference<
    ::com::sun::star::linguistic2::XLinguServiceEventListener >
        SwModule::GetLngSvcEvtListener()
{
    return xLngSvcEvtListener;
}

inline void SwModule::SetLngSvcEvtListener(
    ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
{
    xLngSvcEvtListener = xLstnr;
}

/*-----------------08.07.97 10.33-------------------
    Zugriff auf das SwModule, die ::com::sun::star::sdbcx::View und die Shell
--------------------------------------------------*/

#define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
SwView*     GetActiveView();
SwWrtShell* GetActiveWrtShell();

#endif
<commit_msg>INTEGRATION: CWS tune03 (1.21.90); FILE MERGED 2004/07/19 19:10:42 mhu 1.21.90.1: #i29979# Added SW_DLLPUBLIC/PRIVATE (see swdllapi.h) to exported symbols/classes.<commit_after>/*************************************************************************
 *
 *  $RCSfile: swmodule.hxx,v $
 *
 *  $Revision: 1.23 $
 *
 *  last change: $Author: rt $ $Date: 2004-08-23 08:39:28 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _SWMODULE_HXX
#define _SWMODULE_HXX

#ifndef _LINK_HXX //autogen
#include <tools/link.hxx>
#endif
#ifndef _STRING_HXX
#include <tools/string.hxx>
#endif
#ifndef _VCL_FLDUNIT_HXX
#include <vcl/fldunit.hxx>
#endif
#ifndef _SFXLSTNER_HXX //autogen
#include <svtools/lstner.hxx>
#endif
#ifndef _SFXMODULE_HXX //autogen
#include <sfx2/module.hxx>
#endif

#ifndef INCLUDED_SWDLLAPI_H
#include "swdllapi.h"
#endif
#ifndef _SHELLID_HXX
#include "shellid.hxx"
#endif

#ifndef _COM_SUN_STAR_LINGUISTIC2_XLINGUSERVICEEVENTLISTENER_HPP_
#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
#endif

class SvStringsDtor;
class Color;
class AuthorCharAttr;
class SfxItemSet;
class SfxRequest;
class SfxErrorHandler;
class SwDBConfig;
class SwModuleOptions;
class SwMasterUsrPref;
class SwViewOption;
class SwView;
class SwWrtShell;
class SwPrintOptions;
class SwAutoFmtOpt;
class SwChapterNumRules;
class SwStdFontConfig;
class SwNavigationConfig;
class SwTransferable;
class SwToolbarConfigItem;
class SwAttrPool;
namespace svtools{ class ColorConfig;}
class SvtAccessibilityOptions;
class SvtCTLOptions;
class SvtUserOptions;
class SvtUndoOptions;

struct SwDBData;
#define VIEWOPT_DEST_VIEW       0
#define VIEWOPT_DEST_TEXT       1
#define VIEWOPT_DEST_WEB        2
#define VIEWOPT_DEST_VIEW_ONLY  3 //ViewOptions werden nur an der ::com::sun::star::sdbcx::View, nicht an der Appl. gesetzt

namespace com{ namespace sun{ namespace star{ namespace scanner{
    class XScannerManager;
}}}}

class SwModule: public SfxModule, public SfxListener
{
    String              sActAuthor;

    // ConfigItems
    SwModuleOptions*    pModuleConfig;
    SwMasterUsrPref*    pUsrPref;
    SwMasterUsrPref*    pWebUsrPref;
    SwPrintOptions*     pPrtOpt;
    SwPrintOptions*     pWebPrtOpt;
    SwChapterNumRules*  pChapterNumRules;
    SwStdFontConfig*    pStdFontConfig;
    SwNavigationConfig* pNavigationConfig;
    SwToolbarConfigItem*pToolbarConfig;     //fuer gestackte Toolbars, welche
    SwToolbarConfigItem*pWebToolbarConfig;  //war sichtbar?
    SwDBConfig*         pDBConfig;
    svtools::ColorConfig*   pColorConfig;
    SvtAccessibilityOptions* pAccessibilityOptions;
    SvtCTLOptions*      pCTLOptions;
    SvtUserOptions*     pUserOptions;
    SvtUndoOptions*     pUndoOptions;

    SfxErrorHandler*    pErrorHdl;

    SwAttrPool          *pAttrPool;

    // Die aktuelle View wird hier gehalten um nicht ueber
    // GetActiveView arbeiten zu muessen
    // Die View ist solange gueltig bis Sie im Activate
    // zerstoert oder ausgetauscht wird
    SwView*             pView;

    // Liste aller Redline-Autoren
    SvStringsDtor*      pAuthorNames;

    // DictionaryList listener to trigger spellchecking or hyphenation
    ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
    ::com::sun::star::uno::Reference<
        ::com::sun::star::scanner::XScannerManager >    m_xScannerManager;

    sal_Bool                bAuthorInitialised : 1;
    sal_Bool                bEmbeddedLoadSave : 1;

    virtual void    FillStatusBar( StatusBar& );

    // Hint abfangen fuer DocInfo
    virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );

protected:
    // Briefumschlaege, Etiketten
    void                InsertEnv(SfxRequest&);
    void                InsertLab(SfxRequest&, sal_Bool bLabel);

public:
    // public Data - used for internal Clipboard / Drag & Drop / XSelection
    SwTransferable  *pClipboard, *pDragDrop, *pXSelection;

    TYPEINFO();
    SFX_DECL_INTERFACE(SW_INTERFACE_MODULE);

    // dieser Ctor nur fuer SW-Dll
    SwModule( SfxObjectFactory* pFact,
                SfxObjectFactory* pWebFact,
                    SfxObjectFactory* pGlobalFact );

    ~SwModule();

    // View setzen nur fuer internen Gebrauch,
    // aus techn. Gruenden public
    //
    inline  void        SetView(SwView* pVw) { pView = pVw; }
    inline  SwView*     GetView() { return pView; }

    //Die Handler fuer die Slots
    void                StateOther(SfxItemSet &);   // andere
    void                StateViewOptions(SfxItemSet &);

    void                ExecOther(SfxRequest &);    // Felder, Formel ..
    void                ExecViewOptions(SfxRequest &);
    void                ExecWizzard(SfxRequest &);

    // Benutzereinstellungen modifizieren
    SW_DLLPUBLIC const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const;
    const SwViewOption* GetViewOption(sal_Bool bWeb);
    void                MakeUsrPref( SwViewOption &rToFill, sal_Bool bWeb ) const;
    void                ApplyUsrPref(const SwViewOption &, SwView*,
                                     sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
    void ApplyUserMetric( FieldUnit eMetric, BOOL bWeb );
    SW_DLLPUBLIC void ApplyFldUpdateFlags(sal_Int32 nFldFlags);
    SW_DLLPUBLIC void ApplyLinkMode(sal_Int32 nNewLinkMode);

    // ConfigItems erzeugen
    SwModuleOptions*    GetModuleConfig()       { return pModuleConfig;}
    SW_DLLPUBLIC SwPrintOptions*    GetPrtOptions(sal_Bool bWeb);
    SW_DLLPUBLIC SwChapterNumRules* GetChapterNumRules();
    SwStdFontConfig*    GetStdFontConfig()      { return pStdFontConfig; }
    SwNavigationConfig* GetNavigationConfig();
    SwToolbarConfigItem*GetToolbarConfig()      { return pToolbarConfig;    }
    SwToolbarConfigItem*GetWebToolbarConfig()   { return pWebToolbarConfig; }
    SW_DLLPUBLIC SwDBConfig*            GetDBConfig();
    svtools::ColorConfig&   GetColorConfig();
    SW_DLLPUBLIC SvtAccessibilityOptions&    GetAccessibilityOptions();
    SW_DLLPUBLIC SvtCTLOptions&      GetCTLOptions();
    SvtUserOptions&     GetUserOptions();
    SvtUndoOptions&     GetUndoOptions();

    // Ueber Sichten iterieren
    static SwView*      GetFirstView();
    static SwView*      GetNextView(SwView*);

    sal_Bool IsEmbeddedLoadSave() const         { return bEmbeddedLoadSave; }
    void SetEmbeddedLoadSave( sal_Bool bFlag )  { bEmbeddedLoadSave = bFlag; }

    void ShowDBObj( SwView& rView, const SwDBData& rData, BOOL bOnlyIfAvailable = FALSE);

    // Tabellenmodi
    sal_Bool            IsInsTblFormatNum(sal_Bool bHTML) const;
    sal_Bool            IsInsTblChangeNumFormat(sal_Bool bHTML) const;
    sal_Bool            IsInsTblAlignNum(sal_Bool bHTML) const;

    // Redlining
    sal_uInt16          GetRedlineAuthor();
    const String&       GetRedlineAuthor(sal_uInt16 nPos);
    sal_uInt16          InsertRedlineAuthor(const String& rAuthor);

    void                GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
    void                GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
    void                GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);

    sal_uInt16              GetRedlineMarkPos();
    const Color&            GetRedlineMarkColor();

    // returne den definierten DocStat - WordDelimiter
    const String&       GetDocStatWordDelim() const;

    // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
    sal_uInt16 GetMetric( sal_Bool bWeb ) const;

    // Update-Stati durchreichen
    sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
    sal_uInt16 GetFldUpdateFlags( sal_Bool bWeb ) const;

    //virtuelle Methoden fuer den Optionendialog
    virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId );
    virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
    virtual SfxTabPage*  CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );

    //hier wird der Pool angelegt und an der SfxShell gesetzt
    void    InitAttrPool();
    //Pool loeschen bevor es zu spaet ist
    void    RemoveAttrPool();

    // Invalidiert ggf. OnlineSpell-WrongListen
    void    CheckSpellChanges( sal_Bool bOnlineSpelling,
                    sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain );

    inline ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener >
            GetLngSvcEvtListener();
    inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
    void    CreateLngSvcEvtListener();

    ::com::sun::star::uno::Reference<
        ::com::sun::star::scanner::XScannerManager >
            GetScannerManager();
};

inline ::com::sun::star::uno::Reference<
    ::com::sun::star::linguistic2::XLinguServiceEventListener >
        SwModule::GetLngSvcEvtListener()
{
    return xLngSvcEvtListener;
}

inline void SwModule::SetLngSvcEvtListener(
    ::com::sun::star::uno::Reference<
        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
{
    xLngSvcEvtListener = xLstnr;
}

/*-----------------08.07.97 10.33-------------------
    Zugriff auf das SwModule, die ::com::sun::star::sdbcx::View und die Shell
--------------------------------------------------*/

#define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))

SW_DLLPUBLIC SwView*    GetActiveView();
SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();

#endif
<|endoftext|>


<commit_before>#ifndef BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_
#define BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_

#include <cstdlib>

#include "convergence/single_checker.hpp"

namespace bart {

namespace convergence {

namespace parameters {

/*! \brief Checks for convergence of any parameter expressed as a double.
 *
 * Convergence of a value \f$x\f$ after the \f$i\f$th iteration is determined by
 * a percentage change from the current iteration value:
 *
 * \f[
 * \Delta_i = \frac{|x_i - x_{i-1}|}{|x_i|}
 * \f]
 *
 * Convergence is achieved if \f$ \Delta_i \leq \Delta_{\text{max}}\f$.
 *
 */

class SingleParameterChecker : public SingleChecker<double> {
 public:
  explicit SingleParameterChecker(double max_delta = 1e-6) {
    max_delta_ = max_delta;
  }

  bool CheckIfConverged(const double &current_iteration,
                        const double &previous_iteration) override {
    double diff = std::abs(current_iteration - previous_iteration);
    this->delta_ = diff;
    return (diff/std::abs(current_iteration) <= max_delta_);
  }

 protected:
  using SingleChecker<double>::max_delta_;
};

} // namespace parameters

} // namespace convergence

} // namespace bart

#endif // BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_<commit_msg>Refactored SingleParameterChecker.<commit_after>#ifndef BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_
#define BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_

#include <cstdlib>

#include "convergence/single_checker.hpp"

namespace bart::convergence::parameters {

/*! \brief Checks for convergence of any parameter expressed as a double.
 *
 * Convergence of a value \f$x\f$ after the \f$i\f$th iteration is determined by
 * a percentage change from the current iteration value:
 *
 * \f[
 * \Delta_i = \frac{|x_i - x_{i-1}|}{|x_i|}
 * \f]
 *
 * Convergence is achieved if \f$ \Delta_i \leq \Delta_{\text{max}}\f$.
 *
 */

class SingleParameterChecker : public SingleChecker<double, double> {
 public:
  explicit SingleParameterChecker(double max_delta = 1e-6) { SetMaxDelta(max_delta); }

  auto SetMaxDelta(const double& to_set) -> void override {
    AssertThrow(to_set > 0, dealii::ExcMessage("Error in SingleParameterChecker::SetMaxDelta, value to set must be "
                                               "greater than 0"))
    SingleChecker<double, double>::SetMaxDelta(to_set);
  }

  [[nodiscard]] auto CheckIfConverged(const double &current_value, const double &previous_value) -> bool override {
    double diff = std::abs(current_value - previous_value);
    this->delta_ = diff;
    return (diff/std::abs(current_value) <= max_delta_);
  }

 protected:
  using SingleChecker<double>::max_delta_;
};

} // namespace bart::convergence::parameters

#endif // BART_SRC_CONVERGENCE_PARAMETERS_SINGLE_PARAMETER_CHECKER_HPP_<|endoftext|>