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
|
|
|
|
|
|
|
#ifndef SW_FMTFLD_HXX
|
|
|
|
#define SW_FMTFLD_HXX
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
#include <list>
|
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>
|
|
|
|
#include <svl/brdcst.hxx>
|
|
|
|
#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;
|
2005-06-14 15:26:18 +00:00
|
|
|
class SwTxtFld;
|
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
|
2008-02-19 12:34:16 +00:00
|
|
|
class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend class SwTxtFld;
|
|
|
|
friend void _InitCore();
|
|
|
|
|
2013-06-11 21:49:44 +02:00
|
|
|
::com::sun::star::uno::WeakReference<
|
|
|
|
::com::sun::star::text::XTextField> m_wXTextField;
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
SwField *pField;
|
2011-02-02 17:23:50 +01:00
|
|
|
SwTxtFld* pTxtAttr;
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
SwFmtFld(); ///< Default attibute.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/* Protected CopyCtor.
|
|
|
|
@@@ copy construction allowed, but copy assignment is not? @@@ */
|
2000-09-18 16:15:01 +00:00
|
|
|
SwFmtFld& operator=(const SwFmtFld& rFld);
|
2004-08-23 07:32:59 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
protected:
|
2010-12-21 19:33:34 +01:00
|
|
|
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
|
|
|
|
virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint );
|
2010-12-17 09:02:23 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
|
|
|
TYPEINFO();
|
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Single argument constructors shall be explicit.
|
2004-08-23 07:32:59 +00:00
|
|
|
explicit SwFmtFld( const SwField &rFld );
|
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// @@@ copy construction allowed, but copy assignment is not? @@@
|
2000-09-18 16:15:01 +00:00
|
|
|
SwFmtFld( const SwFmtFld& rAttr );
|
2004-08-23 07:32:59 +00:00
|
|
|
|
|
|
|
virtual ~SwFmtFld();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// "Pure virtual methods" of SfxPoolItem.
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual int operator==( const SfxPoolItem& ) const;
|
|
|
|
virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
|
|
|
|
|
2012-11-07 10:56:27 +09:00
|
|
|
virtual bool GetInfo( SfxPoolItem& rInfo ) const;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-09-24 15:03:38 +00:00
|
|
|
const SwField* GetField() const
|
|
|
|
{
|
|
|
|
return pField;
|
|
|
|
}
|
|
|
|
SwField* GetField()
|
|
|
|
{
|
|
|
|
return pField;
|
|
|
|
}
|
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.
|
|
|
|
*/
|
|
|
|
void SetFld(SwField * pField);
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
const SwTxtFld *GetTxtFld() const { return pTxtAttr; }
|
|
|
|
SwTxtFld *GetTxtFld() { return pTxtAttr; }
|
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
void RegisterToFieldType( SwFieldType& );
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsFldInDoc() const;
|
|
|
|
sal_Bool IsProtect() const;
|
2013-06-11 21:49:44 +02:00
|
|
|
|
|
|
|
SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
|
|
|
|
::com::sun::star::text::XTextField> const& GetXTextField() const
|
|
|
|
{ return m_wXTextField; }
|
|
|
|
SW_DLLPRIVATE void SetXTextField(::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::text::XTextField> const& xTextField)
|
|
|
|
{ m_wXTextField = xTextField; }
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2008-02-19 12:34:16 +00:00
|
|
|
class SW_DLLPUBLIC SwFmtFldHint : public SfxHint
|
|
|
|
{
|
|
|
|
#define SWFMTFLD_INSERTED 1
|
|
|
|
#define SWFMTFLD_REMOVED 2
|
|
|
|
#define SWFMTFLD_FOCUS 3
|
|
|
|
#define SWFMTFLD_CHANGED 4
|
2008-06-16 07:13:37 +00:00
|
|
|
#define SWFMTFLD_LANGUAGE 5
|
2008-02-19 12:34:16 +00:00
|
|
|
|
|
|
|
const SwFmtFld* pFld;
|
|
|
|
sal_Int16 nWhich;
|
2009-09-11 10:21:51 +00:00
|
|
|
const SwView* pView;
|
2008-02-19 12:34:16 +00:00
|
|
|
|
|
|
|
public:
|
2009-09-11 10:21:51 +00:00
|
|
|
SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0)
|
2008-02-19 12:34:16 +00:00
|
|
|
: pFld(p)
|
|
|
|
, nWhich(n)
|
2009-09-11 10:21:51 +00:00
|
|
|
, pView(pV)
|
2008-02-19 12:34:16 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
const SwFmtFld* GetField() const { return pFld; }
|
|
|
|
sal_Int16 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: */
|