2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2013-06-11 21:49:44 +02:00
|
|
|
|
2013-11-05 02:17:53 +01:00
|
|
|
#ifndef INCLUDED_SW_INC_FMTFLD_HXX
|
|
|
|
#define INCLUDED_SW_INC_FMTFLD_HXX
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-11 21:49:44 +02:00
|
|
|
#include <com/sun/star/text/XTextField.hpp>
|
|
|
|
|
|
|
|
#include <cppuhelper/weakref.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/poolitem.hxx>
|
2014-07-16 21:22:34 +02:00
|
|
|
#include <svl/SfxBroadcaster.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/smplhint.hxx>
|
2009-01-02 15:51:45 +00:00
|
|
|
|
2004-08-23 07:32:59 +00:00
|
|
|
#include "swdllapi.h"
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <calbck.hxx>
|
|
|
|
|
|
|
|
class SwField;
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwTextField;
|
2009-09-11 10:21:51 +00:00
|
|
|
class SwView;
|
2010-12-17 09:02:23 +01:00
|
|
|
class SwFieldType;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-02-02 17:23:50 +01:00
|
|
|
// ATT_FLD
|
2015-05-20 13:05:49 +02:00
|
|
|
class SW_DLLPUBLIC SwFormatField
|
2014-08-20 12:41:51 +02:00
|
|
|
: public SfxPoolItem
|
|
|
|
, public SwModify
|
|
|
|
, public SfxBroadcaster
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend void _InitCore();
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatField( sal_uInt16 nWhich ); // for default-Attibute
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-06-11 21:49:44 +02:00
|
|
|
::com::sun::star::uno::WeakReference<
|
|
|
|
::com::sun::star::text::XTextField> m_wXTextField;
|
|
|
|
|
2013-11-18 11:29:24 +00:00
|
|
|
SwField* mpField;
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextField* mpTextField; // the TextAttribute
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2013-11-18 11:29:24 +00:00
|
|
|
// @@@ copy construction allowed, but copy assignment is not? @@@
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatField& operator=(const SwFormatField& rField) SAL_DELETED_FUNCTION;
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
protected:
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
|
|
|
|
virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) SAL_OVERRIDE;
|
2010-12-17 09:02:23 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
2014-03-26 11:54:10 +01:00
|
|
|
TYPEINFO_OVERRIDE();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Single argument constructors shall be explicit.
|
2015-05-20 13:05:49 +02:00
|
|
|
explicit SwFormatField( const SwField &rField );
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// @@@ copy construction allowed, but copy assignment is not? @@@
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatField( const SwFormatField& rAttr );
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
virtual ~SwFormatField();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// "Pure virtual methods" of SfxPoolItem.
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
|
|
|
|
virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual bool GetInfo( SfxPoolItem& rInfo ) const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-08-20 12:41:51 +02:00
|
|
|
void InvalidateField();
|
|
|
|
|
2013-09-24 15:03:38 +00:00
|
|
|
const SwField* GetField() const
|
|
|
|
{
|
2013-11-18 11:29:24 +00:00
|
|
|
return mpField;
|
2013-09-24 15:03:38 +00:00
|
|
|
}
|
|
|
|
SwField* GetField()
|
|
|
|
{
|
2013-11-18 11:29:24 +00:00
|
|
|
return mpField;
|
2013-09-24 15:03:38 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2004-05-18 12:57:37 +00:00
|
|
|
/**
|
|
|
|
Sets current field.
|
|
|
|
|
|
|
|
@param pField new field
|
|
|
|
|
|
|
|
@attention The current field will be destroyed before setting the new field.
|
|
|
|
*/
|
2013-11-18 11:29:24 +00:00
|
|
|
void SetField( SwField * pField );
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTextField* GetTextField() const
|
2013-11-18 11:29:24 +00:00
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
return mpTextField;
|
2013-11-18 11:29:24 +00:00
|
|
|
}
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextField* GetTextField()
|
2013-11-18 11:29:24 +00:00
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
return mpTextField;
|
2013-11-18 11:29:24 +00:00
|
|
|
}
|
2015-05-20 13:05:49 +02:00
|
|
|
void SetTextField( SwTextField& rTextField );
|
|
|
|
void ClearTextField();
|
2004-05-18 12:57:37 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
void RegisterToFieldType( SwFieldType& );
|
2015-05-20 13:05:49 +02:00
|
|
|
bool IsFieldInDoc() const;
|
2014-04-25 14:00:35 +02:00
|
|
|
bool IsProtect() const;
|
2013-06-11 21:49:44 +02:00
|
|
|
|
2014-02-03 14:43:37 +01:00
|
|
|
SAL_DLLPRIVATE ::com::sun::star::uno::WeakReference<
|
2013-06-11 21:49:44 +02:00
|
|
|
::com::sun::star::text::XTextField> const& GetXTextField() const
|
|
|
|
{ return m_wXTextField; }
|
2014-02-03 14:43:37 +01:00
|
|
|
SAL_DLLPRIVATE void SetXTextField(::com::sun::star::uno::Reference<
|
2013-06-11 21:49:44 +02:00
|
|
|
::com::sun::star::text::XTextField> const& xTextField)
|
|
|
|
{ m_wXTextField = xTextField; }
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
enum class SwFormatFieldHintWhich
|
2008-02-19 12:34:16 +00:00
|
|
|
{
|
2014-10-12 01:58:52 +02:00
|
|
|
INSERTED = 1,
|
|
|
|
REMOVED = 2,
|
|
|
|
FOCUS = 3,
|
|
|
|
CHANGED = 4,
|
|
|
|
LANGUAGE = 5
|
|
|
|
};
|
2008-02-19 12:34:16 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SW_DLLPUBLIC SwFormatFieldHint : public SfxHint
|
2014-10-12 01:58:52 +02:00
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwFormatField* pField;
|
|
|
|
SwFormatFieldHintWhich nWhich;
|
2014-10-12 01:58:52 +02:00
|
|
|
const SwView* pView;
|
2008-02-19 12:34:16 +00:00
|
|
|
|
|
|
|
public:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatFieldHint( const SwFormatField* p, SwFormatFieldHintWhich n, const SwView* pV = 0)
|
|
|
|
: pField(p)
|
2008-02-19 12:34:16 +00:00
|
|
|
, nWhich(n)
|
2009-09-11 10:21:51 +00:00
|
|
|
, pView(pV)
|
2008-02-19 12:34:16 +00:00
|
|
|
{}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwFormatField* GetField() const { return pField; }
|
|
|
|
SwFormatFieldHintWhich Which() const { return nWhich; }
|
2009-09-11 10:21:51 +00:00
|
|
|
const SwView* GetView() const { return pView; }
|
2008-02-19 12:34:16 +00:00
|
|
|
};
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|