<commit_before>/*
 * article.cpp
 *
 * Copyright (c) 2001, 2002, 2003, 2004 Frerich Raabe <raabe@kde.org>
 *
 * This program 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. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#include "article.h"
#include "tools_p.h"

#include <kdebug.h>
#include <krfcdate.h>
#include <kurl.h>
#include <kurllabel.h>
#include <kmdcodec.h>

#include <qdatetime.h>
#include <qdom.h>

using namespace RSS;
namespace RSS
{
    KMD5 md5Machine;
}

struct Article::Private : public Shared
{
	QString title;
	KURL link;
	QString description;
	QDateTime pubDate;
	QString guid;
	bool guidIsPermaLink;
    MetaInfoMap meta;
	KURL commentsLink;
	int numComments;
};

Article::Article() : d(new Private)
{
}

Article::Article(const Article &other) : d(0)
{
	*this = other;
}

Article::Article(const QDomNode &node, Format format) : d(new Private)
{
	QString elemText;

	d->numComments=0;

	if (!(elemText = extractNode(node, QString::fromLatin1("title"))).isNull())
		d->title = elemText;

	if (format==AtomFeed)
	{
		QDomNode n;
		for (n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
			const QDomElement e = n.toElement();
			if ( (e.tagName()==QString::fromLatin1("link")) &&
				(e.attribute(QString::fromLatin1("rel"))==QString::fromLatin1("alternate")))
				{
					d->link=n.toElement().attribute(QString::fromLatin1("href"));
					break;
				}
		}
	}
	else
	{
		if (!(elemText = extractNode(node, QString::fromLatin1("link"))).isNull())
			d->link = elemText;
	}

    // prefer content/content:encoded over summary/description for feeds that provide it
    QString tagName=(format==AtomFeed)? QString::fromLatin1("content"): QString::fromLatin1("content:encoded");

    if (!(elemText = extractNode(node, tagName, false)).isNull())
        d->description = elemText;

    if (d->description.isEmpty())
    {
		if (!(elemText = extractNode(node, QString::fromLatin1("body"), false)).isNull())
	    	d->description = elemText;

		if (d->description.isEmpty())  // 3rd try: see http://www.intertwingly.net/blog/1299.html
		{
			if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "summary" : "description"), false)).isNull())
				d->description = elemText;
		}
    }

	if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "created": "pubDate"))).isNull())
    {
		time_t _time;
		if (format==AtomFeed)
		   _time = parseISO8601Date(elemText);
		else
		   _time = KRFCDate::parseDate(elemText);

        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
        if (_time != 0)
		  d->pubDate.setTime_t(_time);
	}
	if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull())
    {
		time_t _time = parseISO8601Date(elemText);

        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
        if (_time != 0)
		  d->pubDate.setTime_t(_time);
	}

	if (!(elemText = extractNode(node, QString::fromLatin1("wfw:comment"))).isNull()) {
		d->commentsLink = elemText;
	}

    if (!(elemText = extractNode(node, QString::fromLatin1("slash:comments"))).isNull()) {
        d->numComments = elemText.toInt();
    }

    QDomElement element = QDomNode(node).toElement();

    // in RSS 1.0, we use <item about> attribute as ID
    // FIXME: pass format version instead of checking for attribute

    if (!element.isNull() && element.hasAttribute(QString::fromLatin1("rdf:about")))
    {
        d->guid = element.attribute(QString::fromLatin1("rdf:about")); // HACK: using ns properly did not work
        d->guidIsPermaLink = false;
    }
    else
    {
        tagName=(format==AtomFeed)? QString::fromLatin1("id"): QString::fromLatin1("guid");
        QDomNode n = node.namedItem(tagName);
	    if (!n.isNull())
        {
            d->guidIsPermaLink = (format==AtomFeed)? false : true;
            if (n.toElement().attribute(QString::fromLatin1("isPermaLink"), "true") == "false") d->guidIsPermaLink = false;
            if (!(elemText = extractNode(node, tagName)).isNull())
                d->guid = elemText;
        }
    }

	if(d->guid.isEmpty()) {
		d->guidIsPermaLink = false;

		md5Machine.reset();
		QDomNode n(node);
		md5Machine.update(d->title.utf8());
		md5Machine.update(d->description.utf8());
		d->guid = QString(md5Machine.hexDigest().data());
        d->meta[QString::fromLatin1("guidIsHash")] = QString::fromLatin1("true");
	}

    for (QDomNode i = node.firstChild(); !i.isNull(); i = i.nextSibling())
    {
        if (i.isElement() && i.toElement().tagName() == QString::fromLatin1("metaInfo:meta"))
        {
            QString type = i.toElement().attribute(QString::fromLatin1("type"));
            d->meta[type] = i.toElement().text();
        }
    }
}

Article::~Article()
{
	if (d->deref())
		delete d;
}

QString Article::title() const
{
	return d->title;
}

const KURL &Article::link() const
{
	return d->link;
}

QString Article::description() const
{
	return d->description;
}

QString Article::guid() const
{
	return d->guid;
}

bool Article::guidIsPermaLink() const
{
	return d->guidIsPermaLink;
}

const QDateTime &Article::pubDate() const
{
	return d->pubDate;
}

const KURL &Article::commentsLink() const
{
	return d->commentsLink;
}

int Article::comments() const
{
	return d->numComments;
}

QString Article::meta(const QString &key) const
{
    return d->meta[key];
}

KURLLabel *Article::widget(QWidget *parent, const char *name) const
{
	KURLLabel *label = new KURLLabel(d->link.url(), d->title, parent, name);
	label->setUseTips(true);
	if (!d->description.isNull())
		label->setTipText(d->description);

	return label;
}

Article &Article::operator=(const Article &other)
{
	if (this != &other) {
		other.d->ref();
		if (d && d->deref())
			delete d;
		d = other.d;
	}
	return *this;
}

bool Article::operator==(const Article &other) const
{
	return d->guid == other.guid();
}

// vim:noet:ts=4
<commit_msg>backport: Atom: use <issued> instead of <created> for pubdates CCBUG: 97874<commit_after>/*
 * article.cpp
 *
 * Copyright (c) 2001, 2002, 2003, 2004 Frerich Raabe <raabe@kde.org>
 *
 * This program 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. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#include "article.h"
#include "tools_p.h"

#include <kdebug.h>
#include <krfcdate.h>
#include <kurl.h>
#include <kurllabel.h>
#include <kmdcodec.h>

#include <qdatetime.h>
#include <qdom.h>

using namespace RSS;
namespace RSS
{
    KMD5 md5Machine;
}

struct Article::Private : public Shared
{
	QString title;
	KURL link;
	QString description;
	QDateTime pubDate;
	QString guid;
	bool guidIsPermaLink;
    MetaInfoMap meta;
	KURL commentsLink;
	int numComments;
};

Article::Article() : d(new Private)
{
}

Article::Article(const Article &other) : d(0)
{
	*this = other;
}

Article::Article(const QDomNode &node, Format format) : d(new Private)
{
	QString elemText;

	d->numComments=0;

	if (!(elemText = extractNode(node, QString::fromLatin1("title"))).isNull())
		d->title = elemText;

	if (format==AtomFeed)
	{
		QDomNode n;
		for (n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
			const QDomElement e = n.toElement();
			if ( (e.tagName()==QString::fromLatin1("link")) &&
				(e.attribute(QString::fromLatin1("rel"))==QString::fromLatin1("alternate")))
				{
					d->link=n.toElement().attribute(QString::fromLatin1("href"));
					break;
				}
		}
	}
	else
	{
		if (!(elemText = extractNode(node, QString::fromLatin1("link"))).isNull())
			d->link = elemText;
	}

    // prefer content/content:encoded over summary/description for feeds that provide it
    QString tagName=(format==AtomFeed)? QString::fromLatin1("content"): QString::fromLatin1("content:encoded");

    if (!(elemText = extractNode(node, tagName, false)).isNull())
        d->description = elemText;

    if (d->description.isEmpty())
    {
		if (!(elemText = extractNode(node, QString::fromLatin1("body"), false)).isNull())
			d->description = elemText;

		if (d->description.isEmpty())  // 3rd try: see http://www.intertwingly.net/blog/1299.html
		{
			if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "summary" : "description"), false)).isNull())
				d->description = elemText;
		}
	}

	time_t time = 0;

	if (format == AtomFeed)
	{
		elemText = extractNode(node, QString::fromLatin1("issued"));
		if (!elemText.isNull())
			time = parseISO8601Date(elemText);
	}
	else
	{
		elemText = extractNode(node, QString::fromLatin1("pubDate"));
		if (!elemText.isNull())
			time = KRFCDate::parseDate(elemText);
	}

	if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull())
	{
		time = parseISO8601Date(elemText);
	}

	// 0 means invalid, not epoch (parsers return epoch+1 when parsing epoch, see the KRFCDate::parseDate() docs)
        if (time != 0)
		d->pubDate.setTime_t(time);

	if (!(elemText = extractNode(node, QString::fromLatin1("wfw:comment"))).isNull()) {
		d->commentsLink = elemText;
	}

    if (!(elemText = extractNode(node, QString::fromLatin1("slash:comments"))).isNull()) {
        d->numComments = elemText.toInt();
    }

    QDomElement element = QDomNode(node).toElement();

    // in RSS 1.0, we use <item about> attribute as ID
    // FIXME: pass format version instead of checking for attribute

    if (!element.isNull() && element.hasAttribute(QString::fromLatin1("rdf:about")))
    {
        d->guid = element.attribute(QString::fromLatin1("rdf:about")); // HACK: using ns properly did not work
        d->guidIsPermaLink = false;
    }
    else
    {
        tagName=(format==AtomFeed)? QString::fromLatin1("id"): QString::fromLatin1("guid");
        QDomNode n = node.namedItem(tagName);
	    if (!n.isNull())
        {
            d->guidIsPermaLink = (format==AtomFeed)? false : true;
            if (n.toElement().attribute(QString::fromLatin1("isPermaLink"), "true") == "false") d->guidIsPermaLink = false;
            if (!(elemText = extractNode(node, tagName)).isNull())
                d->guid = elemText;
        }
    }

	if(d->guid.isEmpty()) {
		d->guidIsPermaLink = false;

		md5Machine.reset();
		QDomNode n(node);
		md5Machine.update(d->title.utf8());
		md5Machine.update(d->description.utf8());
		d->guid = QString(md5Machine.hexDigest().data());
        d->meta[QString::fromLatin1("guidIsHash")] = QString::fromLatin1("true");
	}

    for (QDomNode i = node.firstChild(); !i.isNull(); i = i.nextSibling())
    {
        if (i.isElement() && i.toElement().tagName() == QString::fromLatin1("metaInfo:meta"))
        {
            QString type = i.toElement().attribute(QString::fromLatin1("type"));
            d->meta[type] = i.toElement().text();
        }
    }
}

Article::~Article()
{
	if (d->deref())
		delete d;
}

QString Article::title() const
{
	return d->title;
}

const KURL &Article::link() const
{
	return d->link;
}

QString Article::description() const
{
	return d->description;
}

QString Article::guid() const
{
	return d->guid;
}

bool Article::guidIsPermaLink() const
{
	return d->guidIsPermaLink;
}

const QDateTime &Article::pubDate() const
{
	return d->pubDate;
}

const KURL &Article::commentsLink() const
{
	return d->commentsLink;
}

int Article::comments() const
{
	return d->numComments;
}

QString Article::meta(const QString &key) const
{
    return d->meta[key];
}

KURLLabel *Article::widget(QWidget *parent, const char *name) const
{
	KURLLabel *label = new KURLLabel(d->link.url(), d->title, parent, name);
	label->setUseTips(true);
	if (!d->description.isNull())
		label->setTipText(d->description);

	return label;
}

Article &Article::operator=(const Article &other)
{
	if (this != &other) {
		other.d->ref();
		if (d && d->deref())
			delete d;
		d = other.d;
	}
	return *this;
}

bool Article::operator==(const Article &other) const
{
	return d->guid == other.guid();
}

// vim:noet:ts=4
<|endoftext|>


<commit_before>#ifndef AMGCL_PRECONDITIONER_CPR_HPP
#define AMGCL_PRECONDITIONER_CPR_HPP

/*
The MIT License

Copyright (c) 2012-2016 Denis Demidov <dennis.demidov@gmail.com>

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.
*/

/**
 * \file   amgcl/preconditioner/cpr.hpp
 * \author Denis Demidov <dennis.demidov@gmail.com>
 * \brief  Two stage preconditioner of the Constrained Pressure Residual type.
 */

#include <vector>

#include <boost/shared_ptr.hpp>

#include <amgcl/backend/builtin.hpp>
#include <amgcl/util.hpp>

namespace amgcl {
namespace preconditioner {

template <class PPrecond, class SPrecond>
class cpr_drs {
    BOOST_STATIC_ASSERT_MSG(
            (
             boost::is_same<
                 typename PPrecond::backend_type,
                 typename SPrecond::backend_type
                 >::value
            ),
            "Backends for pressure and flow preconditioners should coinside!"
            );
    public:
        typedef typename PPrecond::backend_type backend_type;

        typedef typename backend_type::value_type value_type;
        typedef typename backend_type::matrix     matrix;
        typedef typename backend_type::vector     vector;
        typedef typename backend_type::params     backend_params;

        typedef typename backend::builtin<value_type>::matrix build_matrix;

        struct params {
            typedef typename PPrecond::params pprecond_params;
            typedef typename SPrecond::params sprecond_params;

            pprecond_params pprecond;
            sprecond_params sprecond;

            int    block_size;
            size_t active_rows;
            double eps_dd;
            double eps_ps;

            params() : block_size(2), active_rows(0), eps_dd(0.2), eps_ps(0.02) {}

            params(const boost::property_tree::ptree &p)
                : AMGCL_PARAMS_IMPORT_CHILD(p, pprecond),
                  AMGCL_PARAMS_IMPORT_CHILD(p, sprecond),
                  AMGCL_PARAMS_IMPORT_VALUE(p, block_size),
                  AMGCL_PARAMS_IMPORT_VALUE(p, active_rows),
                  AMGCL_PARAMS_IMPORT_VALUE(p, eps_dd),
                  AMGCL_PARAMS_IMPORT_VALUE(p, eps_ps)
            { }

            void get(boost::property_tree::ptree &p, const std::string &path = "") const
            {
                AMGCL_PARAMS_EXPORT_CHILD(p, path, pprecond);
                AMGCL_PARAMS_EXPORT_CHILD(p, path, sprecond);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, block_size);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, active_rows);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, eps_dd);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, eps_ps);
            }
        } prm;

        template <class Matrix>
        cpr_drs(
                const Matrix &K,
                const params &prm = params(),
                const backend_params &bprm = backend_params()
               ) : prm(prm), n(backend::rows(K))
        {
            init(boost::make_shared<build_matrix>(K), bprm);
        }

        cpr_drs(
                boost::shared_ptr<build_matrix> K,
                const params &prm = params(),
                const backend_params bprm = backend_params()
               ) : prm(prm), n(backend::rows(*K))
        {
            init(K, bprm);
        }

        template <class Vec1, class Vec2>
        void apply(
                const Vec1 &rhs,
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
                Vec2       &x
#else
                Vec2       &&x
#endif
                ) const
        {
            S->apply(rhs, x);
            backend::residual(rhs, S->system_matrix(), x, *rs);

            backend::spmv(1, *Fpp, *rs, 0, *rp);
            P->apply(*rp, *xp);

            backend::spmv(1, *Scatter, *xp, 1, x);
        }

        const matrix& system_matrix() const {
            return S->system_matrix();
        }

    private:
        size_t n, np;

        boost::shared_ptr<PPrecond> P;
        boost::shared_ptr<SPrecond> S;

        boost::shared_ptr<matrix> Fpp, Scatter;
        boost::shared_ptr<vector> rp, xp, rs;

        void init(boost::shared_ptr<build_matrix> K, const backend_params bprm)
        {
            typedef typename backend::row_iterator<build_matrix>::type row_iterator;
            const int       B = prm.block_size;
            const ptrdiff_t N = (prm.active_rows ? prm.active_rows : n);

            np = N / B;

            boost::shared_ptr<build_matrix> fpp = boost::make_shared<build_matrix>();
            fpp->nrows = np;
            fpp->ncols = n;

            fpp->col.resize(n);
            fpp->val.resize(n, 1);
            fpp->ptr.resize(np+1);
            fpp->ptr[0] = 0;

            boost::shared_ptr<build_matrix> App = boost::make_shared<build_matrix>();
            App->nrows = App->ncols = np;
            App->ptr.resize(np+1, 0);

#pragma omp parallel
            {
                std::vector<value_type> a_dia(B), a_off(B), a_top(B);
                std::vector<row_iterator> k; k.reserve(B);

#pragma omp for
                for(ptrdiff_t ip = 0; ip < static_cast<ptrdiff_t>(np); ++ip) {
                    ptrdiff_t ik = ip * B;
                    bool      done = true;
                    ptrdiff_t cur_col;

                    boost::fill(a_dia, 0);
                    boost::fill(a_off, 0);
                    boost::fill(a_top, 0);

                    k.clear();
                    for(int i = 0; i < B; ++i) {
                        k.push_back(backend::row_begin(*K, ik + i));

                        if (k.back() && k.back().col() < N) {
                            ptrdiff_t col = k.back().col() / B;
                            if (done) {
                                cur_col = col;
                                done = false;
                            } else {
                                cur_col = std::min(cur_col, col);
                            }
                        }
                    }

                    while (!done) {
                        ++App->ptr[ip+1];

                        ptrdiff_t end = (cur_col + 1) * B;

                        for(int i = 0; i < B; ++i) {
                            for(; k[i] && k[i].col() < end; ++k[i]) {
                                ptrdiff_t  c = k[i].col() % B;
                                value_type v = k[i].value();

                                if (i == 0) {
                                    a_top[c] += std::abs(v);
                                }

                                if (c == 0) {
                                    if (cur_col == ip) {
                                        a_dia[i] = v;
                                    } else {
                                        a_off[i] += std::abs(v);
                                    }
                                }
                            }
                        }

                        // Get next column number.
                        done = true;
                        for(int i = 0; i < B; ++i) {
                            if (k[i] && k[i].col() < N) {
                                ptrdiff_t col = k[i].col() / B;
                                if (done) {
                                    cur_col = col;
                                    done = false;
                                } else {
                                    cur_col = std::min(cur_col, col);
                                }
                            }
                        }
                    }

                    for(int i = 0; i < B; ++i) {
                        fpp->col[ik+i] = ik+i;
                        if (a_dia[i] < prm.eps_dd * a_off[i])
                            fpp->val[ik+i] = 0;
                        if (a_top[i] < prm.eps_ps * std::abs(a_dia[0]))
                            fpp->val[ik+i] = 0;
                    }

                    fpp->val[ik] = 1; // Keep delta[0] = 1
                    fpp->ptr[ip+1] = ik + B;
                }
            }

            boost::partial_sum(App->ptr, App->ptr.begin());

            App->col.resize(App->ptr.back());
            App->val.resize(App->ptr.back());

            boost::shared_ptr<build_matrix> scatter = boost::make_shared<build_matrix>();
            scatter->nrows = n;
            scatter->ncols = np;

            scatter->ptr.resize(n+1);
            scatter->ptr[0] = 0;
            scatter->col.resize(np);
            scatter->val.resize(np, 1);

#pragma omp parallel
            {
                std::vector<row_iterator> k; k.reserve(B);

#pragma omp for
                for(ptrdiff_t ip = 0; ip < static_cast<ptrdiff_t>(np); ++ip) {
                    ptrdiff_t ik = ip * B;
                    ptrdiff_t head = App->ptr[ip];
                    bool      done = true;
                    ptrdiff_t cur_col;

                    value_type *d = &fpp->val[ik];

                    k.clear();
                    for(int i = 0; i < B; ++i) {
                        k.push_back(backend::row_begin(*K, ik + i));

                        if (k.back() && k.back().col() < N) {
                            ptrdiff_t col = k.back().col() / B;
                            if (done) {
                                cur_col = col;
                                done = false;
                            } else {
                                cur_col = std::min(cur_col, col);
                            }
                        }
                    }

                    while (!done) {
                        ptrdiff_t  end = (cur_col + 1) * B;
                        value_type app = 0;

                        for(int i = 0; i < B; ++i) {
                            for(; k[i] && k[i].col() < end; ++k[i]) {
                                if (k[i].col() % B == 0) {
                                    app += d[i] * k[i].value();
                                }
                            }
                        }

                        App->col[head] = cur_col;
                        App->val[head] = app;
                        ++head;

                        // Get next column number.
                        done = true;
                        for(int i = 0; i < B; ++i) {
                            if (k[i] && k[i].col() < N) {
                                ptrdiff_t col = k[i].col() / B;
                                if (done) {
                                    cur_col = col;
                                    done = false;
                                } else {
                                    cur_col = std::min(cur_col, col);
                                }
                            }
                        }
                    }

                    scatter->col[ip] = ip;
                    ptrdiff_t nnz = ip;
                    for(int i = 0; i < B; ++i) {
                        if (i == 0) ++nnz;
                        scatter->ptr[ik + i + 1] = nnz;
                    }
                }
            }

            for(size_t i = N; i < n; ++i)
                scatter->ptr[i+1] = scatter->ptr[i];

            P = boost::make_shared<PPrecond>(App, prm.pprecond, bprm);
            S = boost::make_shared<SPrecond>(K,   prm.sprecond, bprm);

            Fpp     = backend_type::copy_matrix(fpp, bprm);
            Scatter = backend_type::copy_matrix(scatter, bprm);

            rp = backend_type::create_vector(np, bprm);
            xp = backend_type::create_vector(np, bprm);
            rs = backend_type::create_vector(n, bprm);
        }

};

} // namespace preconditioner
} // namespace amgcl

#endif
<commit_msg>Fix header guard in cpr_drs<commit_after>#ifndef AMGCL_PRECONDITIONER_CPR_DRS_HPP
#define AMGCL_PRECONDITIONER_CPR_DRS_HPP

/*
The MIT License

Copyright (c) 2012-2016 Denis Demidov <dennis.demidov@gmail.com>

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.
*/

/**
 * \file   amgcl/preconditioner/cpr_drs.hpp
 * \author Denis Demidov <dennis.demidov@gmail.com>
 * \brief  CPR preconditioner with Dynamic Row Sum modification.
 */

#include <vector>

#include <boost/shared_ptr.hpp>

#include <amgcl/backend/builtin.hpp>
#include <amgcl/util.hpp>

namespace amgcl {
namespace preconditioner {

template <class PPrecond, class SPrecond>
class cpr_drs {
    BOOST_STATIC_ASSERT_MSG(
            (
             boost::is_same<
                 typename PPrecond::backend_type,
                 typename SPrecond::backend_type
                 >::value
            ),
            "Backends for pressure and flow preconditioners should coinside!"
            );
    public:
        typedef typename PPrecond::backend_type backend_type;

        typedef typename backend_type::value_type value_type;
        typedef typename backend_type::matrix     matrix;
        typedef typename backend_type::vector     vector;
        typedef typename backend_type::params     backend_params;

        typedef typename backend::builtin<value_type>::matrix build_matrix;

        struct params {
            typedef typename PPrecond::params pprecond_params;
            typedef typename SPrecond::params sprecond_params;

            pprecond_params pprecond;
            sprecond_params sprecond;

            int    block_size;
            size_t active_rows;
            double eps_dd;
            double eps_ps;

            params() : block_size(2), active_rows(0), eps_dd(0.2), eps_ps(0.02) {}

            params(const boost::property_tree::ptree &p)
                : AMGCL_PARAMS_IMPORT_CHILD(p, pprecond),
                  AMGCL_PARAMS_IMPORT_CHILD(p, sprecond),
                  AMGCL_PARAMS_IMPORT_VALUE(p, block_size),
                  AMGCL_PARAMS_IMPORT_VALUE(p, active_rows),
                  AMGCL_PARAMS_IMPORT_VALUE(p, eps_dd),
                  AMGCL_PARAMS_IMPORT_VALUE(p, eps_ps)
            { }

            void get(boost::property_tree::ptree &p, const std::string &path = "") const
            {
                AMGCL_PARAMS_EXPORT_CHILD(p, path, pprecond);
                AMGCL_PARAMS_EXPORT_CHILD(p, path, sprecond);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, block_size);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, active_rows);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, eps_dd);
                AMGCL_PARAMS_EXPORT_VALUE(p, path, eps_ps);
            }
        } prm;

        template <class Matrix>
        cpr_drs(
                const Matrix &K,
                const params &prm = params(),
                const backend_params &bprm = backend_params()
               ) : prm(prm), n(backend::rows(K))
        {
            init(boost::make_shared<build_matrix>(K), bprm);
        }

        cpr_drs(
                boost::shared_ptr<build_matrix> K,
                const params &prm = params(),
                const backend_params bprm = backend_params()
               ) : prm(prm), n(backend::rows(*K))
        {
            init(K, bprm);
        }

        template <class Vec1, class Vec2>
        void apply(
                const Vec1 &rhs,
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
                Vec2       &x
#else
                Vec2       &&x
#endif
                ) const
        {
            S->apply(rhs, x);
            backend::residual(rhs, S->system_matrix(), x, *rs);

            backend::spmv(1, *Fpp, *rs, 0, *rp);
            P->apply(*rp, *xp);

            backend::spmv(1, *Scatter, *xp, 1, x);
        }

        const matrix& system_matrix() const {
            return S->system_matrix();
        }

    private:
        size_t n, np;

        boost::shared_ptr<PPrecond> P;
        boost::shared_ptr<SPrecond> S;

        boost::shared_ptr<matrix> Fpp, Scatter;
        boost::shared_ptr<vector> rp, xp, rs;

        void init(boost::shared_ptr<build_matrix> K, const backend_params bprm)
        {
            typedef typename backend::row_iterator<build_matrix>::type row_iterator;
            const int       B = prm.block_size;
            const ptrdiff_t N = (prm.active_rows ? prm.active_rows : n);

            np = N / B;

            boost::shared_ptr<build_matrix> fpp = boost::make_shared<build_matrix>();
            fpp->nrows = np;
            fpp->ncols = n;

            fpp->col.resize(n);
            fpp->val.resize(n, 1);
            fpp->ptr.resize(np+1);
            fpp->ptr[0] = 0;

            boost::shared_ptr<build_matrix> App = boost::make_shared<build_matrix>();
            App->nrows = App->ncols = np;
            App->ptr.resize(np+1, 0);

#pragma omp parallel
            {
                std::vector<value_type> a_dia(B), a_off(B), a_top(B);
                std::vector<row_iterator> k; k.reserve(B);

#pragma omp for
                for(ptrdiff_t ip = 0; ip < static_cast<ptrdiff_t>(np); ++ip) {
                    ptrdiff_t ik = ip * B;
                    bool      done = true;
                    ptrdiff_t cur_col;

                    boost::fill(a_dia, 0);
                    boost::fill(a_off, 0);
                    boost::fill(a_top, 0);

                    k.clear();
                    for(int i = 0; i < B; ++i) {
                        k.push_back(backend::row_begin(*K, ik + i));

                        if (k.back() && k.back().col() < N) {
                            ptrdiff_t col = k.back().col() / B;
                            if (done) {
                                cur_col = col;
                                done = false;
                            } else {
                                cur_col = std::min(cur_col, col);
                            }
                        }
                    }

                    while (!done) {
                        ++App->ptr[ip+1];

                        ptrdiff_t end = (cur_col + 1) * B;

                        for(int i = 0; i < B; ++i) {
                            for(; k[i] && k[i].col() < end; ++k[i]) {
                                ptrdiff_t  c = k[i].col() % B;
                                value_type v = k[i].value();

                                if (i == 0) {
                                    a_top[c] += std::abs(v);
                                }

                                if (c == 0) {
                                    if (cur_col == ip) {
                                        a_dia[i] = v;
                                    } else {
                                        a_off[i] += std::abs(v);
                                    }
                                }
                            }
                        }

                        // Get next column number.
                        done = true;
                        for(int i = 0; i < B; ++i) {
                            if (k[i] && k[i].col() < N) {
                                ptrdiff_t col = k[i].col() / B;
                                if (done) {
                                    cur_col = col;
                                    done = false;
                                } else {
                                    cur_col = std::min(cur_col, col);
                                }
                            }
                        }
                    }

                    for(int i = 0; i < B; ++i) {
                        fpp->col[ik+i] = ik+i;
                        if (a_dia[i] < prm.eps_dd * a_off[i])
                            fpp->val[ik+i] = 0;
                        if (a_top[i] < prm.eps_ps * std::abs(a_dia[0]))
                            fpp->val[ik+i] = 0;
                    }

                    fpp->val[ik] = 1; // Keep delta[0] = 1
                    fpp->ptr[ip+1] = ik + B;
                }
            }

            boost::partial_sum(App->ptr, App->ptr.begin());

            App->col.resize(App->ptr.back());
            App->val.resize(App->ptr.back());

            boost::shared_ptr<build_matrix> scatter = boost::make_shared<build_matrix>();
            scatter->nrows = n;
            scatter->ncols = np;

            scatter->ptr.resize(n+1);
            scatter->ptr[0] = 0;
            scatter->col.resize(np);
            scatter->val.resize(np, 1);

#pragma omp parallel
            {
                std::vector<row_iterator> k; k.reserve(B);

#pragma omp for
                for(ptrdiff_t ip = 0; ip < static_cast<ptrdiff_t>(np); ++ip) {
                    ptrdiff_t ik = ip * B;
                    ptrdiff_t head = App->ptr[ip];
                    bool      done = true;
                    ptrdiff_t cur_col;

                    value_type *d = &fpp->val[ik];

                    k.clear();
                    for(int i = 0; i < B; ++i) {
                        k.push_back(backend::row_begin(*K, ik + i));

                        if (k.back() && k.back().col() < N) {
                            ptrdiff_t col = k.back().col() / B;
                            if (done) {
                                cur_col = col;
                                done = false;
                            } else {
                                cur_col = std::min(cur_col, col);
                            }
                        }
                    }

                    while (!done) {
                        ptrdiff_t  end = (cur_col + 1) * B;
                        value_type app = 0;

                        for(int i = 0; i < B; ++i) {
                            for(; k[i] && k[i].col() < end; ++k[i]) {
                                if (k[i].col() % B == 0) {
                                    app += d[i] * k[i].value();
                                }
                            }
                        }

                        App->col[head] = cur_col;
                        App->val[head] = app;
                        ++head;

                        // Get next column number.
                        done = true;
                        for(int i = 0; i < B; ++i) {
                            if (k[i] && k[i].col() < N) {
                                ptrdiff_t col = k[i].col() / B;
                                if (done) {
                                    cur_col = col;
                                    done = false;
                                } else {
                                    cur_col = std::min(cur_col, col);
                                }
                            }
                        }
                    }

                    scatter->col[ip] = ip;
                    ptrdiff_t nnz = ip;
                    for(int i = 0; i < B; ++i) {
                        if (i == 0) ++nnz;
                        scatter->ptr[ik + i + 1] = nnz;
                    }
                }
            }

            for(size_t i = N; i < n; ++i)
                scatter->ptr[i+1] = scatter->ptr[i];

            P = boost::make_shared<PPrecond>(App, prm.pprecond, bprm);
            S = boost::make_shared<SPrecond>(K,   prm.sprecond, bprm);

            Fpp     = backend_type::copy_matrix(fpp, bprm);
            Scatter = backend_type::copy_matrix(scatter, bprm);

            rp = backend_type::create_vector(np, bprm);
            xp = backend_type::create_vector(np, bprm);
            rs = backend_type::create_vector(n, bprm);
        }

};

} // namespace preconditioner
} // namespace amgcl

#endif
<|endoftext|>


<commit_before><commit_msg>fix string conversion in 1da3af5f1eb6a32fd0ab10da7cf2f8ddb298a3a1<commit_after><|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: pickerhistory.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: obo $ $Date: 2005-04-13 10:25:01 $
 *
 *  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 EXPRESS 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 SVTOOLS_PICKERHISTORY_HXX
#define SVTOOLS_PICKERHISTORY_HXX

#ifndef INCLUDED_SVLDLLAPI_H
#include "svtools/svldllapi.h"
#endif

#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
#include <com/sun/star/uno/XInterface.hpp>
#endif

//.........................................................................
namespace svt
{
//.........................................................................

    // --------------------------------------------------------------------
    SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
                GetTopMostFolderPicker( );

    SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
                GetTopMostFilePicker( );

//.........................................................................
}   // namespace svt
//.........................................................................

#endif // SVTOOLS_PICKERHISTORY_HXX

<commit_msg>INTEGRATION: CWS ooo19126 (1.3.140); FILE MERGED 2005/09/05 14:50:57 rt 1.3.140.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: pickerhistory.hxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 10:04:15 $
 *
 *  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 SVTOOLS_PICKERHISTORY_HXX
#define SVTOOLS_PICKERHISTORY_HXX

#ifndef INCLUDED_SVLDLLAPI_H
#include "svtools/svldllapi.h"
#endif

#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
#include <com/sun/star/uno/XInterface.hpp>
#endif

//.........................................................................
namespace svt
{
//.........................................................................

    // --------------------------------------------------------------------
    SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
                GetTopMostFolderPicker( );

    SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
                GetTopMostFilePicker( );

//.........................................................................
}   // namespace svt
//.........................................................................

#endif // SVTOOLS_PICKERHISTORY_HXX

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: poolio.hxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: hr $ $Date: 2007-06-27 21:37:41 $
 *
 *  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
 *
 ************************************************************************/
#include <svtools/brdcst.hxx>

#ifndef DELETEZ
#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
#endif

struct SfxPoolVersion_Impl
{
    USHORT          _nVer;
    USHORT          _nStart, _nEnd;
    USHORT*         _pMap;

                    SfxPoolVersion_Impl( USHORT nVer, USHORT nStart, USHORT nEnd,
                                         USHORT *pMap )
                    :   _nVer( nVer ),
                        _nStart( nStart ),
                        _nEnd( nEnd ),
                        _pMap( pMap )
                    {}
                    SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig )
                    :   _nVer( rOrig._nVer ),
                        _nStart( rOrig._nStart ),
                        _nEnd( rOrig._nEnd ),
                        _pMap( rOrig._pMap )
                    {}
};

SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 )
SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 )

struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
{
    USHORT  nFirstFree;

    SfxPoolItemArray_Impl (USHORT nInitSize = 0)
        : SfxPoolItemArrayBase_Impl( nInitSize ),
          nFirstFree( 0 )
    {}
};

class SfxStyleSheetIterator;

struct SfxItemPool_Impl
{
    SfxBroadcaster                  aBC;
    SfxPoolItemArray_Impl**         ppPoolItems;
    SfxPoolVersionArr_Impl          aVersions;
    USHORT                          nVersion;
    USHORT                          nLoadingVersion;
    USHORT                          nInitRefCount; // 1, beim Laden ggf. 2
    USHORT                          nVerStart, nVerEnd; // WhichRange in Versions
    USHORT                          nStoringStart, nStoringEnd; // zu speichernder Range
    BYTE                            nMajorVer, nMinorVer; // Pool selbst
    SfxMapUnit                      eDefMetric;
    FASTBOOL                        bInSetItem;
    FASTBOOL                        bStreaming; // in Load() bzw. Store()

    SfxItemPool_Impl( USHORT nStart, USHORT nEnd )
        : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1])
    {
        memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) );
    }

    ~SfxItemPool_Impl()
    {
        delete[] ppPoolItems;
    }

    void DeleteItems()
    {
        delete[] ppPoolItems; ppPoolItems = 0;
    }
};

// -----------------------------------------------------------------------

// IBM-C-Set mag keine doppelten Defines
#ifdef DBG
#  undef DBG
#endif

#if defined(DBG_UTIL) && defined(MSC)
#define SFX_TRACE(s,p) \
        { \
            ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \
            _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \
                       "%lp", p ); \
            aPtr.Insert(s, 0); \
            DbgTrace( aPtr.GetBuffer() ); \
        }
#define DBG(x) x
#else
#define SFX_TRACE(s,p)
#define DBG(x)
#endif

#define CHECK_FILEFORMAT( rStream, nTag ) \
    {   USHORT nFileTag; \
        rStream >> nFileTag; \
        if ( nTag != nFileTag ) \
        { \
            DBG_ERROR( #nTag ); /*! s.u. */ \
            /*! error-code setzen und auswerten! */ \
            (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
            pImp->bStreaming = FALSE; \
            return rStream; \
        } \
    }

#define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \
    {   USHORT nFileTag; \
        rStream >> nFileTag; \
        if ( nTag1 != nFileTag && nTag2 != nFileTag ) \
        { \
            DBG_ERROR( #nTag1 ); /*! s.u. */ \
            /*! error-code setzen und auswerten! */ \
            (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
            pImp->bStreaming = FALSE; \
            return rStream; \
        } \
    }

#define SFX_ITEMPOOL_VER_MAJOR          BYTE(2)
#define SFX_ITEMPOOL_VER_MINOR          BYTE(0)

#define SFX_ITEMPOOL_TAG_STARTPOOL_4    USHORT(0x1111)
#define SFX_ITEMPOOL_TAG_STARTPOOL_5    USHORT(0xBBBB)
#define SFX_ITEMPOOL_TAG_ITEMPOOL       USHORT(0xAAAA)
#define SFX_ITEMPOOL_TAG_ITEMS          USHORT(0x2222)
#define SFX_ITEMPOOL_TAG_ITEM           USHORT(0x7777)
#define SFX_ITEMPOOL_TAG_SIZES          USHORT(0x3333)
#define SFX_ITEMPOOL_TAG_DEFAULTS       USHORT(0x4444)
#define SFX_ITEMPOOL_TAG_VERSIONMAP     USHORT(0x5555)
#define SFX_ITEMPOOL_TAG_HEADER         USHORT(0x6666)
#define SFX_ITEMPOOL_TAG_ENDPOOL        USHORT(0xEEEE)
#define SFX_ITEMPOOL_TAG_TRICK4OLD      USHORT(0xFFFF)

#define SFX_ITEMPOOL_REC                BYTE(0x01)
#define SFX_ITEMPOOL_REC_HEADER         BYTE(0x10)
#define SFX_ITEMPOOL_REC_VERSIONMAP     USHORT(0x0020)
#define SFX_ITEMPOOL_REC_WHICHIDS       USHORT(0x0030)
#define SFX_ITEMPOOL_REC_ITEMS          USHORT(0x0040)
#define SFX_ITEMPOOL_REC_DEFAULTS       USHORT(0x0050)

#define SFX_ITEMSET_REC                 BYTE(0x02)

#define SFX_STYLES_REC                  BYTE(0x03)
#define SFX_STYLES_REC_HEADER       USHORT(0x0010)
#define SFX_STYLES_REC_STYLES       USHORT(0x0020)

//========================================================================

inline USHORT SfxItemPool::GetIndex_Impl(USHORT nWhich) const
{
    DBG_CHKTHIS(SfxItemPool, 0);
    DBG_ASSERT(nWhich >= nStart && nWhich <= nEnd, "Which-Id nicht im Pool-Bereich");
    return nWhich - nStart;
}

<commit_msg>INTEGRATION: CWS mba24issues01 (1.5.102); FILE MERGED 2007/11/01 10:59:06 mba 1.5.102.1: #i79179#: memory leak fixed<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: poolio.hxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: obo $ $Date: 2008-01-04 14:57:27 $
 *
 *  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
 *
 ************************************************************************/
#include <svtools/brdcst.hxx>

#ifndef DELETEZ
#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
#endif

struct SfxPoolVersion_Impl
{
    USHORT          _nVer;
    USHORT          _nStart, _nEnd;
    USHORT*         _pMap;

                    SfxPoolVersion_Impl( USHORT nVer, USHORT nStart, USHORT nEnd,
                                         USHORT *pMap )
                    :   _nVer( nVer ),
                        _nStart( nStart ),
                        _nEnd( nEnd ),
                        _pMap( pMap )
                    {}
                    SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig )
                    :   _nVer( rOrig._nVer ),
                        _nStart( rOrig._nStart ),
                        _nEnd( rOrig._nEnd ),
                        _pMap( rOrig._pMap )
                    {}
};

SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 )
SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 )

struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
{
    USHORT  nFirstFree;

    SfxPoolItemArray_Impl (USHORT nInitSize = 0)
        : SfxPoolItemArrayBase_Impl( nInitSize ),
          nFirstFree( 0 )
    {}
};

class SfxStyleSheetIterator;

struct SfxItemPool_Impl
{
    SfxBroadcaster                  aBC;
    SfxPoolItemArray_Impl**         ppPoolItems;
    SfxPoolVersionArr_Impl          aVersions;
    USHORT                          nVersion;
    USHORT                          nLoadingVersion;
    USHORT                          nInitRefCount; // 1, beim Laden ggf. 2
    USHORT                          nVerStart, nVerEnd; // WhichRange in Versions
    USHORT                          nStoringStart, nStoringEnd; // zu speichernder Range
    BYTE                            nMajorVer, nMinorVer; // Pool selbst
    SfxMapUnit                      eDefMetric;
    FASTBOOL                        bInSetItem;
    FASTBOOL                        bStreaming; // in Load() bzw. Store()

    SfxItemPool_Impl( USHORT nStart, USHORT nEnd )
        : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1])
    {
        memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) );
    }

    ~SfxItemPool_Impl()
    {
        delete[] ppPoolItems;
    }

    void DeleteItems()
    {
        delete[] ppPoolItems; ppPoolItems = 0;
    }
};

// -----------------------------------------------------------------------

// IBM-C-Set mag keine doppelten Defines
#ifdef DBG
#  undef DBG
#endif

#if defined(DBG_UTIL) && defined(MSC)
#define SFX_TRACE(s,p) \
        { \
            ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \
            _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \
                       "%lp", p ); \
            aPtr.Insert(s, 0); \
            DbgTrace( aPtr.GetBuffer() ); \
        }
#define DBG(x) x
#else
#define SFX_TRACE(s,p)
#define DBG(x)
#endif

#define CHECK_FILEFORMAT( rStream, nTag ) \
    {   USHORT nFileTag; \
        rStream >> nFileTag; \
        if ( nTag != nFileTag ) \
        { \
            DBG_ERROR( #nTag ); /*! s.u. */ \
            /*! error-code setzen und auswerten! */ \
            (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
            pImp->bStreaming = FALSE; \
            return rStream; \
        } \
    }

#define CHECK_FILEFORMAT_RELEASE( rStream, nTag, pPointer ) \
   {   USHORT nFileTag; \
       rStream >> nFileTag; \
       if ( nTag != nFileTag ) \
        { \
            DBG_ERROR( #nTag ); /*! s.u. */ \
           /*! error-code setzen und auswerten! */ \
           (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
           pImp->bStreaming = FALSE; \
           delete pPointer; \
            return rStream; \
        } \
    }

#define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \
    {   USHORT nFileTag; \
        rStream >> nFileTag; \
        if ( nTag1 != nFileTag && nTag2 != nFileTag ) \
        { \
            DBG_ERROR( #nTag1 ); /*! s.u. */ \
            /*! error-code setzen und auswerten! */ \
            (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
            pImp->bStreaming = FALSE; \
            return rStream; \
        } \
    }

#define SFX_ITEMPOOL_VER_MAJOR          BYTE(2)
#define SFX_ITEMPOOL_VER_MINOR          BYTE(0)

#define SFX_ITEMPOOL_TAG_STARTPOOL_4    USHORT(0x1111)
#define SFX_ITEMPOOL_TAG_STARTPOOL_5    USHORT(0xBBBB)
#define SFX_ITEMPOOL_TAG_ITEMPOOL       USHORT(0xAAAA)
#define SFX_ITEMPOOL_TAG_ITEMS          USHORT(0x2222)
#define SFX_ITEMPOOL_TAG_ITEM           USHORT(0x7777)
#define SFX_ITEMPOOL_TAG_SIZES          USHORT(0x3333)
#define SFX_ITEMPOOL_TAG_DEFAULTS       USHORT(0x4444)
#define SFX_ITEMPOOL_TAG_VERSIONMAP     USHORT(0x5555)
#define SFX_ITEMPOOL_TAG_HEADER         USHORT(0x6666)
#define SFX_ITEMPOOL_TAG_ENDPOOL        USHORT(0xEEEE)
#define SFX_ITEMPOOL_TAG_TRICK4OLD      USHORT(0xFFFF)

#define SFX_ITEMPOOL_REC                BYTE(0x01)
#define SFX_ITEMPOOL_REC_HEADER         BYTE(0x10)
#define SFX_ITEMPOOL_REC_VERSIONMAP     USHORT(0x0020)
#define SFX_ITEMPOOL_REC_WHICHIDS       USHORT(0x0030)
#define SFX_ITEMPOOL_REC_ITEMS          USHORT(0x0040)
#define SFX_ITEMPOOL_REC_DEFAULTS       USHORT(0x0050)

#define SFX_ITEMSET_REC                 BYTE(0x02)

#define SFX_STYLES_REC                  BYTE(0x03)
#define SFX_STYLES_REC_HEADER       USHORT(0x0010)
#define SFX_STYLES_REC_STYLES       USHORT(0x0020)

//========================================================================

inline USHORT SfxItemPool::GetIndex_Impl(USHORT nWhich) const
{
    DBG_CHKTHIS(SfxItemPool, 0);
    DBG_ASSERT(nWhich >= nStart && nWhich <= nEnd, "Which-Id nicht im Pool-Bereich");
    return nWhich - nStart;
}

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: linkdlg.hxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: obo $ $Date: 2006-10-12 12:18:06 $
 *
 *  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 _LINKDLG_HXX
#define _LINKDLG_HXX

#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
#endif

#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/lstbox.hxx>

#include <svtools/svmedit.hxx>  // MultiLineEdit
#include <svtools/svtabbx.hxx>  // MultiLineEdit

/********************** SvUpdateLinksDialog ******************************
*************************************************************************/
namespace sfx2
{
    class SvLinkManager;
    class SvBaseLink;
}

class SvBaseLinksDlg : public ModalDialog
{
    using Window::SetType;

    FixedText aFtFiles;
    FixedText aFtLinks;
    FixedText aFtType;
    FixedText aFtStatus;
    CancelButton aCancelButton1;
    HelpButton aHelpButton1;
    PushButton aPbUpdateNow;
    PushButton aPbOpenSource;
    PushButton aPbChangeSource;
    PushButton aPbBreakLink;
    FixedText aFtFiles2;
    FixedText aFtSource2;
    FixedText aFtType2;
    FixedText aFtUpdate;
    RadioButton aRbAutomatic;
    RadioButton aRbManual;
    FixedText aFtFullFileName;
    FixedText aFtFullSourceName;
    FixedText aFtFullTypeName;
    String aStrAutolink;
    String aStrManuallink;
    String aStrBrokenlink;
    String aStrGraphiclink;
    String aStrButtonclose;
    String aStrCloselinkmsg;
    String aStrCloselinkmsgMulti;
    String aStrWaitinglink;
    sfx2::SvLinkManager*  pLinkMgr;
    BOOL            bHtmlMode;
    SvTabListBox aTbLinks;
    Timer aUpdateTimer;

#if _SOLAR__PRIVATE
    DECL_LINK( LinksSelectHdl, SvTabListBox * );
    DECL_LINK( LinksDoubleClickHdl, SvTabListBox * );
    DECL_LINK( AutomaticClickHdl, RadioButton * );
    DECL_LINK( ManualClickHdl, RadioButton * );
    DECL_LINK( UpdateNowClickHdl, PushButton * );
    DECL_LINK( OpenSourceClickHdl, PushButton * );
    DECL_LINK( ChangeSourceClickHdl, PushButton * );
    DECL_LINK( BreakLinkClickHdl, PushButton * );
    DECL_LINK( UpdateWaitingHdl, Timer * );
    sfx2::SvBaseLink* GetSelEntry( USHORT* pPos );
    String ImplGetStateStr( const sfx2::SvBaseLink& );
    void SetType( sfx2::SvBaseLink& rLink, USHORT nPos, USHORT nType );
    void InsertEntry( const sfx2::SvBaseLink& rLink, USHORT nPos = LISTBOX_APPEND, sal_Bool bSelect = sal_False);
#endif

    void StartUpdateTimer()         { aUpdateTimer.Start(); }

    SvTabListBox&     Links()       { return aTbLinks; }
    FixedText&      FileName()      { return aFtFullFileName; }
    FixedText&      SourceName()    { return aFtFullSourceName; }
    FixedText&      TypeName()      { return aFtFullTypeName; }
    RadioButton&    Automatic()     { return aRbAutomatic; }
    RadioButton&    Manual()        { return aRbManual; }
    PushButton&     UpdateNow()     { return aPbUpdateNow; }
    PushButton&     OpenSource()    { return aPbOpenSource; }
    PushButton&     ChangeSource()  { return aPbChangeSource; }
    PushButton&     BreakLink()     { return aPbBreakLink; }

    String&         Autolink()      { return aStrAutolink; }
    String&         Manuallink()    { return aStrManuallink; }
    String&         Brokenlink()    { return aStrBrokenlink; }
    String&         Graphiclink()   { return aStrGraphiclink; }
    String&         Buttonclose()   { return aStrButtonclose; }
    String&         Closelinkmsg()  { return aStrCloselinkmsg; }
    String&         CloselinkmsgMulti() { return aStrCloselinkmsgMulti; }
    String&         Waitinglink()   { return aStrWaitinglink; }
    void SetManager( sfx2::SvLinkManager* );

public:
    SvBaseLinksDlg( Window * pParent, sfx2::SvLinkManager*, BOOL bHtml = FALSE );
    ~SvBaseLinksDlg();
    void SetActLink( sfx2::SvBaseLink * pLink );
};

#endif // _LINKDLG_HXX
<commit_msg>INTEGRATION: CWS asyncdialogs (1.3.180); FILE MERGED 2006/10/31 15:04:19 pb 1.3.180.2: RESYNC: (1.3-1.4); FILE MERGED 2006/03/22 07:34:44 pb 1.3.180.1: fix: #i57125# EndEditHdl() added<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: linkdlg.hxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: vg $ $Date: 2006-11-22 10:35:39 $
 *
 *  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 _LINKDLG_HXX
#define _LINKDLG_HXX

#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
#endif

#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/lstbox.hxx>

#include <svtools/svmedit.hxx>  // MultiLineEdit
#include <svtools/svtabbx.hxx>  // MultiLineEdit

/********************** SvUpdateLinksDialog ******************************
*************************************************************************/
namespace sfx2
{
    class SvLinkManager;
    class SvBaseLink;
}

class SvBaseLinksDlg : public ModalDialog
{
    using Window::SetType;

    FixedText aFtFiles;
    FixedText aFtLinks;
    FixedText aFtType;
    FixedText aFtStatus;
    CancelButton aCancelButton1;
    HelpButton aHelpButton1;
    PushButton aPbUpdateNow;
    PushButton aPbOpenSource;
    PushButton aPbChangeSource;
    PushButton aPbBreakLink;
    FixedText aFtFiles2;
    FixedText aFtSource2;
    FixedText aFtType2;
    FixedText aFtUpdate;
    RadioButton aRbAutomatic;
    RadioButton aRbManual;
    FixedText aFtFullFileName;
    FixedText aFtFullSourceName;
    FixedText aFtFullTypeName;
    String aStrAutolink;
    String aStrManuallink;
    String aStrBrokenlink;
    String aStrGraphiclink;
    String aStrButtonclose;
    String aStrCloselinkmsg;
    String aStrCloselinkmsgMulti;
    String aStrWaitinglink;
    sfx2::SvLinkManager*  pLinkMgr;
    BOOL            bHtmlMode;
    SvTabListBox aTbLinks;
    Timer aUpdateTimer;

#if _SOLAR__PRIVATE
    DECL_LINK( LinksSelectHdl, SvTabListBox * );
    DECL_LINK( LinksDoubleClickHdl, SvTabListBox * );
    DECL_LINK( AutomaticClickHdl, RadioButton * );
    DECL_LINK( ManualClickHdl, RadioButton * );
    DECL_LINK( UpdateNowClickHdl, PushButton * );
    DECL_LINK( OpenSourceClickHdl, PushButton * );
    DECL_LINK( ChangeSourceClickHdl, PushButton * );
    DECL_LINK( BreakLinkClickHdl, PushButton * );
    DECL_LINK( UpdateWaitingHdl, Timer * );
    DECL_LINK( EndEditHdl, sfx2::SvBaseLink* );
    sfx2::SvBaseLink* GetSelEntry( USHORT* pPos );
    String ImplGetStateStr( const sfx2::SvBaseLink& );
    void SetType( sfx2::SvBaseLink& rLink, USHORT nPos, USHORT nType );
    void InsertEntry( const sfx2::SvBaseLink& rLink, USHORT nPos = LISTBOX_APPEND, sal_Bool bSelect = sal_False);
#endif

    void StartUpdateTimer()         { aUpdateTimer.Start(); }

    SvTabListBox&     Links()       { return aTbLinks; }
    FixedText&      FileName()      { return aFtFullFileName; }
    FixedText&      SourceName()    { return aFtFullSourceName; }
    FixedText&      TypeName()      { return aFtFullTypeName; }
    RadioButton&    Automatic()     { return aRbAutomatic; }
    RadioButton&    Manual()        { return aRbManual; }
    PushButton&     UpdateNow()     { return aPbUpdateNow; }
    PushButton&     OpenSource()    { return aPbOpenSource; }
    PushButton&     ChangeSource()  { return aPbChangeSource; }
    PushButton&     BreakLink()     { return aPbBreakLink; }

    String&         Autolink()      { return aStrAutolink; }
    String&         Manuallink()    { return aStrManuallink; }
    String&         Brokenlink()    { return aStrBrokenlink; }
    String&         Graphiclink()   { return aStrGraphiclink; }
    String&         Buttonclose()   { return aStrButtonclose; }
    String&         Closelinkmsg()  { return aStrCloselinkmsg; }
    String&         CloselinkmsgMulti() { return aStrCloselinkmsgMulti; }
    String&         Waitinglink()   { return aStrWaitinglink; }
    void SetManager( sfx2::SvLinkManager* );

public:
    SvBaseLinksDlg( Window * pParent, sfx2::SvLinkManager*, BOOL bHtml = FALSE );
    ~SvBaseLinksDlg();
    void SetActLink( sfx2::SvBaseLink * pLink );
};

#endif // _LINKDLG_HXX
<|endoftext|>


<commit_before><commit_msg>tdf#89666: vcl: speed up HbLayoutEngine line layout for large paragraphs<commit_after><|endoftext|>


<commit_before><commit_msg>This is an int, not float<commit_after><|endoftext|>


<commit_before><commit_msg>Fixed premature wrapping, black spot in A1 and scrollbar and button position.<commit_after><|endoftext|>


<commit_before>// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t

struct C {
  static void foo();
  static int x;
  int nsx;
  void mf() {
    (void)&x;    // OK, x is accessed inside the struct.
    (void)&C::x; // OK, x is accessed using a qualified-id.
    foo();       // OK, foo() is accessed inside the struct.
  }
  void ns() const;
};

int C::x = 0;

struct CC {
  void foo();
  int x;
};

template <typename T> struct CT {
  static T foo();
  static T x;
  int nsx;
  void mf() {
    (void)&x;    // OK, x is accessed inside the struct.
    (void)&C::x; // OK, x is accessed using a qualified-id.
    foo();       // OK, foo() is accessed inside the struct.
  }
};

// Expressions with side effects
C &f(int, int, int, int);
void g() {
  f(1, 2, 3, 4).x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance  [readability-static-accessed-through-instance]
  // CHECK-FIXES: {{^}}  f(1, 2, 3, 4).x;{{$}}
}

int i(int &);
void j(int);
C h();
bool a();
int k(bool);

void f(C c) {
  j(i(h().x));
  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: static member
  // CHECK-FIXES: {{^}}  j(i(h().x));{{$}}

  // The execution of h() depends on the return value of a().
  j(k(a() && h().x));
  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: static member
  // CHECK-FIXES: {{^}}  j(k(a() && h().x));{{$}}

  if ([c]() {
        c.ns();
        return c;
      }().x == 15)
    ;
  // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: static member
  // CHECK-FIXES: {{^}}  if ([c]() {{{$}}
}

// Nested specifiers
namespace N {
struct V {
  static int v;
  struct T {
    static int t;
    struct U {
      static int u;
    };
  };
};
}

void f(N::V::T::U u) {
  N::V v;
  v.v = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  N::V::v = 12;{{$}}

  N::V::T w;
  w.t = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  N::V::T::t = 12;{{$}}

  // u.u is not changed to N::V::T::U::u; because the nesting level is over 3.
  u.u = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  u.u = 12;{{$}}

  using B = N::V::T::U;
  B b;
  b.u;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  B::u;{{$}}
}

// Templates
template <typename T> T CT<T>::x;

template <typename T> struct CCT {
  T foo();
  T x;
};

typedef C D;

using E = D;

#define FOO(c) c.foo()
#define X(c) c.x

template <typename T> void f(T t, C c) {
  t.x; // OK, t is a template parameter.
  c.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::x; // 1{{$}}
}

template <int N> struct S { static int x; };

template <> struct S<0> { int x; };

template <int N> void h() {
  S<N> sN;
  sN.x; // OK, value of N affects whether x is static or not.

  S<2> s2;
  s2.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  S<2>::x;{{$}}
}

void static_through_instance() {
  C *c1 = new C();
  c1->foo(); // 1
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::foo(); // 1{{$}}
  c1->x; // 2
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::x; // 2{{$}}
  c1->nsx; // OK, nsx is a non-static member.

  const C *c2 = new C();
  c2->foo(); // 2
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::foo(); // 2{{$}}

  C::foo(); // OK, foo() is accessed using a qualified-id.
  C::x;     // OK, x is accessed using a qualified-id.

  D d;
  d.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  D::foo();{{$}}
  d.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  D::x;{{$}}

  E e;
  e.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  E::foo();{{$}}
  e.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  E::x;{{$}}

  CC *cc = new CC;

  f(*c1, *c1);
  f(*cc, *c1);

  // Macros: OK, macros are not checked.
  FOO((*c1));
  X((*c1));
  FOO((*cc));
  X((*cc));

  // Templates
  CT<int> ct;
  ct.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  CT<int>::foo();{{$}}
  ct.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  CT<int>::x;{{$}}
  ct.nsx; // OK, nsx is a non-static member

  CCT<int> cct;
  cct.foo(); // OK, CCT has no static members.
  cct.x;     // OK, CCT has no static members.

  h<4>();
}

// Overloaded member access operator
struct Q {
  static int K;
  int y = 0;
};

int Q::K = 0;

struct Qptr {
  Q *q;

  explicit Qptr(Q *qq) : q(qq) {}

  Q *operator->() {
    ++q->y;
    return q;
  }
};

int func(Qptr qp) {
  qp->y = 10; // OK, the overloaded operator might have side-effects.
  qp->K = 10; //
}
<commit_msg>[clang-tidy] Fix a check-fixes line<commit_after>// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t

struct C {
  static void foo();
  static int x;
  int nsx;
  void mf() {
    (void)&x;    // OK, x is accessed inside the struct.
    (void)&C::x; // OK, x is accessed using a qualified-id.
    foo();       // OK, foo() is accessed inside the struct.
  }
  void ns() const;
};

int C::x = 0;

struct CC {
  void foo();
  int x;
};

template <typename T> struct CT {
  static T foo();
  static T x;
  int nsx;
  void mf() {
    (void)&x;    // OK, x is accessed inside the struct.
    (void)&C::x; // OK, x is accessed using a qualified-id.
    foo();       // OK, foo() is accessed inside the struct.
  }
};

// Expressions with side effects
C &f(int, int, int, int);
void g() {
  f(1, 2, 3, 4).x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance  [readability-static-accessed-through-instance]
  // CHECK-FIXES: {{^}}  f(1, 2, 3, 4).x;{{$}}
}

int i(int &);
void j(int);
C h();
bool a();
int k(bool);

void f(C c) {
  j(i(h().x));
  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: static member
  // CHECK-FIXES: {{^}}  j(i(h().x));{{$}}

  // The execution of h() depends on the return value of a().
  j(k(a() && h().x));
  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: static member
  // CHECK-FIXES: {{^}}  j(k(a() && h().x));{{$}}

  if ([c]() {
        c.ns();
        return c;
      }().x == 15)
    ;
  // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: static member
  // CHECK-FIXES: {{^}}  if ([c]() {{{$}}
}

// Nested specifiers
namespace N {
struct V {
  static int v;
  struct T {
    static int t;
    struct U {
      static int u;
    };
  };
};
}

void f(N::V::T::U u) {
  N::V v;
  v.v = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  N::V::v = 12;{{$}}

  N::V::T w;
  w.t = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  N::V::T::t = 12;{{$}}

  // u.u is not changed to N::V::T::U::u; because the nesting level is over 3.
  u.u = 12;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  u.u = 12;{{$}}

  using B = N::V::T::U;
  B b;
  b.u;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  B::u;{{$}}
}

// Templates
template <typename T> T CT<T>::x;

template <typename T> struct CCT {
  T foo();
  T x;
};

typedef C D;

using E = D;

#define FOO(c) c.foo()
#define X(c) c.x

template <typename T> void f(T t, C c) {
  t.x; // OK, t is a template parameter.
  c.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::x;{{$}}
}

template <int N> struct S { static int x; };

template <> struct S<0> { int x; };

template <int N> void h() {
  S<N> sN;
  sN.x; // OK, value of N affects whether x is static or not.

  S<2> s2;
  s2.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  S<2>::x;{{$}}
}

void static_through_instance() {
  C *c1 = new C();
  c1->foo(); // 1
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::foo(); // 1{{$}}
  c1->x; // 2
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::x; // 2{{$}}
  c1->nsx; // OK, nsx is a non-static member.

  const C *c2 = new C();
  c2->foo(); // 2
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  C::foo(); // 2{{$}}

  C::foo(); // OK, foo() is accessed using a qualified-id.
  C::x;     // OK, x is accessed using a qualified-id.

  D d;
  d.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  D::foo();{{$}}
  d.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  D::x;{{$}}

  E e;
  e.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  E::foo();{{$}}
  e.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  E::x;{{$}}

  CC *cc = new CC;

  f(*c1, *c1);
  f(*cc, *c1);

  // Macros: OK, macros are not checked.
  FOO((*c1));
  X((*c1));
  FOO((*cc));
  X((*cc));

  // Templates
  CT<int> ct;
  ct.foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  CT<int>::foo();{{$}}
  ct.x;
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
  // CHECK-FIXES: {{^}}  CT<int>::x;{{$}}
  ct.nsx; // OK, nsx is a non-static member

  CCT<int> cct;
  cct.foo(); // OK, CCT has no static members.
  cct.x;     // OK, CCT has no static members.

  h<4>();
}

// Overloaded member access operator
struct Q {
  static int K;
  int y = 0;
};

int Q::K = 0;

struct Qptr {
  Q *q;

  explicit Qptr(Q *qq) : q(qq) {}

  Q *operator->() {
    ++q->y;
    return q;
  }
};

int func(Qptr qp) {
  qp->y = 10; // OK, the overloaded operator might have side-effects.
  qp->K = 10; //
}
<|endoftext|>


<commit_before><commit_msg>dr78: #i106108# SetDocumentModified also for page margins<commit_after><|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: svditer.cxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: rt $ $Date: 2004-04-02 14:12:49 $
 *
 *  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 _SVDITER_HXX
#include "svditer.hxx"
#endif

#ifndef _SVDPAGE_HXX
#include "svdpage.hxx"
#endif

#ifndef _SVDOGRP_HXX
#include "svdogrp.hxx"
#endif

#ifndef _SVDOBJ_HXX
#include "svdobj.hxx"
#endif

// #99190#
#ifndef _E3D_SCENE3D_HXX
#include "scene3d.hxx"
#endif

SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bReverse)
:   maObjList(1024, 64, 64),
    mnIndex(0L),
    mbReverse(bReverse)
{
    ImpProcessObjectList(rObjList, eMode);
    Reset();
}

SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, BOOL bReverse )
:   maObjList(1024, 64, 64),
    mnIndex(0L),
    mbReverse(bReverse)
{
    if ( rObj.ISA( SdrObjGroup ) )
        ImpProcessObjectList(*rObj.GetSubList(), eMode);
    else
        maObjList.Insert( (void*)&rObj, LIST_APPEND );
    Reset();
}

void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode)
{
    for(sal_uInt32 a(0L); a < rObjList.GetObjCount(); a++)
    {
        SdrObject* pObj = rObjList.GetObj(a);
        sal_Bool bIsGroup(pObj->IsGroupObject());

        // #99190# 3D objects are no group objects, IsGroupObject()
        // only tests if pSub is not null ptr :-(
        if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene))
            bIsGroup = sal_False;

        if(eMode != IM_DEEPNOGROUPS || !bIsGroup)
            maObjList.Insert(pObj, LIST_APPEND);

        if(bIsGroup && eMode != IM_FLAT)
            ImpProcessObjectList(*pObj->GetSubList(), eMode);
    }
}

<commit_msg>INTEGRATION: CWS ooo19126 (1.4.952); FILE MERGED 2005/09/05 14:27:10 rt 1.4.952.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: svditer.cxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-09 00:29: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 _SVDITER_HXX
#include "svditer.hxx"
#endif

#ifndef _SVDPAGE_HXX
#include "svdpage.hxx"
#endif

#ifndef _SVDOGRP_HXX
#include "svdogrp.hxx"
#endif

#ifndef _SVDOBJ_HXX
#include "svdobj.hxx"
#endif

// #99190#
#ifndef _E3D_SCENE3D_HXX
#include "scene3d.hxx"
#endif

SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bReverse)
:   maObjList(1024, 64, 64),
    mnIndex(0L),
    mbReverse(bReverse)
{
    ImpProcessObjectList(rObjList, eMode);
    Reset();
}

SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, BOOL bReverse )
:   maObjList(1024, 64, 64),
    mnIndex(0L),
    mbReverse(bReverse)
{
    if ( rObj.ISA( SdrObjGroup ) )
        ImpProcessObjectList(*rObj.GetSubList(), eMode);
    else
        maObjList.Insert( (void*)&rObj, LIST_APPEND );
    Reset();
}

void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode)
{
    for(sal_uInt32 a(0L); a < rObjList.GetObjCount(); a++)
    {
        SdrObject* pObj = rObjList.GetObj(a);
        sal_Bool bIsGroup(pObj->IsGroupObject());

        // #99190# 3D objects are no group objects, IsGroupObject()
        // only tests if pSub is not null ptr :-(
        if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene))
            bIsGroup = sal_False;

        if(eMode != IM_DEEPNOGROUPS || !bIsGroup)
            maObjList.Insert(pObj, LIST_APPEND);

        if(bIsGroup && eMode != IM_FLAT)
            ImpProcessObjectList(*pObj->GetSubList(), eMode);
    }
}

<|endoftext|>


<commit_before><commit_msg>disable borders for tabbar in Calc (ScTabControl)<commit_after><|endoftext|>


<commit_before><commit_msg>Resolves: #i123003# Corrected Handle/Overlay visualization...<commit_after><|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: tabvwsh.cxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: obo $ $Date: 2004-08-12 09:30:33 $
 *
 *  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): _______________________________________
 *
 *
 ************************************************************************/

#ifdef PCH
#include "ui_pch.hxx"
#endif

#pragma hdrstop

//------------------------------------------------------------------
// INCLUDE ---------------------------------------------------------------

#include "scitems.hxx"
#include <svx/galbrws.hxx>
#include <svx/imapdlg.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/templdlg.hxx>
#include <sfx2/app.hxx>
#include <avmedia/mediaplayer.hxx>

#include "tabvwsh.hxx"
#include "docsh.hxx"
#include "reffact.hxx"
#include "scresid.hxx"
#include "dwfunctr.hxx"
#include "sc.hrc"       // -> SID_TOOL_xxx
#include "drawattr.hxx" // -> SvxDrawToolItem

#define ScTabViewShell
#include "scslots.hxx"

#define SearchSettings
#include <svx/svxslots.hxx>

TYPEINIT2(ScTabViewShell,SfxViewShell,SfxListener);

SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
{
    SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS  | SFX_VISIBILITY_STANDARD |
                                SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
                                ScResId(RID_OBJECTBAR_TOOLS) );

    SFX_CHILDWINDOW_REGISTRATION(FID_INPUTLINE_STATUS);
    SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
    SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScTabOpDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFilterDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSpecialFilterDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScDbNameDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScConsolidateDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScChartDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScPrintAreasDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScCondFormatDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScColRowNameRangesDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFormulaDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFunctionChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFormulaDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScAcceptChgDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScHighlightChgDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSimpleRefDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(SID_SEARCH_DLG);
    SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG);
    SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
}

SFX_IMPL_VIEWFACTORY( ScTabViewShell, ScResId(STR_NONAME) )
{
    SFX_VIEW_REGISTRATION(ScDocShell);
}

//------------------------------------------------------------------

<commit_msg>INTEGRATION: CWS os19 (1.6.104); FILE MERGED 2004/09/12 16:46:56 os 1.6.104.2: RESYNC: (1.6-1.7); FILE MERGED 2004/06/10 13:20:12 dr 1.6.104.1: #i22092# new spellcheck dialog, first step<commit_after>/*************************************************************************
 *
 *  $RCSfile: tabvwsh.cxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: rt $ $Date: 2004-09-17 13:56:01 $
 *
 *  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): _______________________________________
 *
 *
 ************************************************************************/

#ifdef PCH
#include "ui_pch.hxx"
#endif

#pragma hdrstop

//------------------------------------------------------------------
// INCLUDE ---------------------------------------------------------------

#include "scitems.hxx"
#include <svx/galbrws.hxx>
#include <svx/imapdlg.hxx>
#include <svx/srchitem.hxx>
#include <sfx2/templdlg.hxx>
#include <sfx2/app.hxx>
#include <avmedia/mediaplayer.hxx>

#include "tabvwsh.hxx"
#include "docsh.hxx"
#include "reffact.hxx"
#include "scresid.hxx"
#include "dwfunctr.hxx"
#include "sc.hrc"       // -> SID_TOOL_xxx
#include "drawattr.hxx" // -> SvxDrawToolItem
#include "spelldialog.hxx"

#define ScTabViewShell
#include "scslots.hxx"

#define SearchSettings
#include <svx/svxslots.hxx>

TYPEINIT2(ScTabViewShell,SfxViewShell,SfxListener);

SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
{
    SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS  | SFX_VISIBILITY_STANDARD |
                                SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
                                ScResId(RID_OBJECTBAR_TOOLS) );

    SFX_CHILDWINDOW_REGISTRATION(FID_INPUTLINE_STATUS);
    SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
    SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScTabOpDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFilterDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSpecialFilterDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScDbNameDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScConsolidateDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScChartDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScPrintAreasDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScCondFormatDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScColRowNameRangesDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFormulaDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFunctionChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScFormulaDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScAcceptChgDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScHighlightChgDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSimpleRefDlgWrapper::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(SID_SEARCH_DLG);
    SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG);
    SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION(ScSpellDialogChildWindow::GetChildWindowId());
    SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
}

SFX_IMPL_VIEWFACTORY( ScTabViewShell, ScResId(STR_NONAME) )
{
    SFX_VIEW_REGISTRATION(ScDocShell);
}

//------------------------------------------------------------------

<|endoftext|>