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-11-05 02:17:53 +01:00
|
|
|
#ifndef INCLUDED_SW_INC_USRFLD_HXX
|
|
|
|
#define INCLUDED_SW_INC_USRFLD_HXX
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2004-08-23 07:42:14 +00:00
|
|
|
#include "swdllapi.h"
|
2000-09-18 16:15:01 +00:00
|
|
|
#include "fldbas.hxx"
|
|
|
|
|
|
|
|
class SfxPoolItem;
|
|
|
|
class SwCalc;
|
|
|
|
class SwDoc;
|
|
|
|
|
2004-08-23 07:42:14 +00:00
|
|
|
class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2012-11-17 19:04:02 +09:00
|
|
|
bool bValidValue : 1;
|
|
|
|
bool bDeleted : 1;
|
2000-09-18 16:15:01 +00:00
|
|
|
double nValue;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aName;
|
2013-07-14 15:21:18 +02:00
|
|
|
OUString aContent;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nType;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
public:
|
2013-07-14 15:21:18 +02:00
|
|
|
SwUserFieldType( SwDoc* pDocPtr, const OUString& );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual OUString GetName() const SAL_OVERRIDE;
|
|
|
|
virtual SwFieldType* Copy() const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
OUString Expand(sal_uInt32 nFormat, sal_uInt16 nSubType, sal_uInt16 nLng);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
OUString GetContent( sal_uInt32 nFormat = 0 );
|
|
|
|
void SetContent( const OUString& rStr, sal_uInt32 nFormat = 0 );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
inline bool IsValid() const;
|
|
|
|
inline void ChgValid( bool bNew );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-04-25 22:51:51 +02:00
|
|
|
double GetValue(SwCalc& rCalc); // Recalculate member nValue.
|
2000-09-18 16:15:01 +00:00
|
|
|
inline double GetValue() const;
|
|
|
|
inline void SetValue(const double nVal);
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
inline sal_uInt16 GetType() const;
|
|
|
|
inline void SetType(sal_uInt16);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
bool IsDeleted() const { return bDeleted; }
|
|
|
|
void SetDeleted( bool b ) { bDeleted = b; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const SAL_OVERRIDE;
|
|
|
|
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) SAL_OVERRIDE;
|
2011-02-09 15:55:27 +01:00
|
|
|
|
|
|
|
protected:
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
inline bool SwUserFieldType::IsValid() const
|
2000-09-18 16:15:01 +00:00
|
|
|
{ return bValidValue; }
|
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
inline void SwUserFieldType::ChgValid( bool bNew )
|
2000-09-18 16:15:01 +00:00
|
|
|
{ bValidValue = bNew; }
|
|
|
|
|
|
|
|
inline double SwUserFieldType::GetValue() const
|
|
|
|
{ return nValue; }
|
|
|
|
|
|
|
|
inline void SwUserFieldType::SetValue(const double nVal)
|
|
|
|
{ nValue = nVal; }
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
inline sal_uInt16 SwUserFieldType::GetType() const
|
2000-09-18 16:15:01 +00:00
|
|
|
{ return nType; }
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
inline void SwUserFieldType::SetType(sal_uInt16 nSub)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
nType = nSub;
|
2007-09-27 07:17:08 +00:00
|
|
|
EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2009-01-05 14:06:42 +00:00
|
|
|
class SW_DLLPUBLIC SwUserField : public SwValueField
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nSubType;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual OUString Expand() const SAL_OVERRIDE;
|
|
|
|
virtual SwField* Copy() const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
public:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwUserField(SwUserFieldType*, sal_uInt16 nSub = 0, sal_uInt32 nFormat = 0);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual sal_uInt16 GetSubType() const SAL_OVERRIDE;
|
|
|
|
virtual void SetSubType(sal_uInt16 nSub) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual double GetValue() const SAL_OVERRIDE;
|
|
|
|
virtual void SetValue( const double& rVal ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual OUString GetFieldName() const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-04-25 22:51:51 +02:00
|
|
|
// Name cannot be changed.
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual OUString GetPar1() const SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-04-25 22:51:51 +02:00
|
|
|
// Content.
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual OUString GetPar2() const SAL_OVERRIDE;
|
|
|
|
virtual void SetPar2(const OUString& rStr) SAL_OVERRIDE;
|
|
|
|
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const SAL_OVERRIDE;
|
|
|
|
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2013-11-05 02:17:53 +01:00
|
|
|
#endif // INCLUDED_SW_INC_USRFLD_HXX
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|