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_FMTCOL_HXX
|
|
|
|
#define INCLUDED_SW_INC_FMTCOL_HXX
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2004-08-23 07:32:29 +00:00
|
|
|
#include "swdllapi.h"
|
2013-05-27 09:59:19 +02:00
|
|
|
#include <frmatr.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <swtypes.hxx>
|
2012-07-13 15:28:03 +02:00
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
2013-10-20 15:15:42 +01:00
|
|
|
#include <rtl/ustring.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-22 21:50:37 +03:00
|
|
|
class SwDoc;
|
2014-08-08 19:16:38 +02:00
|
|
|
namespace sw{ class DocumentStylePoolManager; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwFormatColl : public SwFormat
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
protected:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatColl( SwAttrPool& rPool, const sal_Char* pFormatName,
|
|
|
|
const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
|
|
|
|
sal_uInt16 nFormatWhich )
|
|
|
|
: SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
|
2014-01-28 19:59:54 +01:00
|
|
|
{ SetAuto( false ); }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
|
|
|
|
const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
|
|
|
|
sal_uInt16 nFormatWhich )
|
|
|
|
: SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
|
2014-01-28 19:59:54 +01:00
|
|
|
{ SetAuto( false ); }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
private:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatColl(const SwFormatColl & ) SAL_DELETED_FUNCTION;
|
|
|
|
const SwFormatColl &operator=(const SwFormatColl &) SAL_DELETED_FUNCTION;
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2012-03-09 13:08:10 +01:00
|
|
|
/// Represents the style of a paragraph.
|
2015-05-20 13:05:49 +02:00
|
|
|
class SW_DLLPUBLIC SwTextFormatColl: public SwFormatColl
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend class SwDoc;
|
2014-08-08 19:16:38 +02:00
|
|
|
friend class ::sw::DocumentStylePoolManager;
|
2004-09-08 13:50:21 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextFormatColl(const SwTextFormatColl & rRef) SAL_DELETED_FUNCTION;
|
2004-09-08 13:50:21 +00:00
|
|
|
|
2007-02-05 09:51:35 +00:00
|
|
|
bool mbStayAssignedToListLevelOfOutlineStyle;
|
2009-01-07 11:57:24 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
protected:
|
2010-11-15 11:59:57 +00:00
|
|
|
|
|
|
|
bool mbAssignedToOutlineStyle;
|
2009-01-07 11:57:24 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextFormatColl *pNextTextFormatColl;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
|
|
|
|
SwTextFormatColl* pDerFrom = 0,
|
|
|
|
sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
|
|
|
|
: SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
|
2014-06-27 12:27:55 +00:00
|
|
|
, mbStayAssignedToListLevelOfOutlineStyle(false)
|
|
|
|
, mbAssignedToOutlineStyle(false)
|
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
pNextTextFormatColl = this;
|
2014-06-27 12:27:55 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
|
|
|
|
SwTextFormatColl* pDerFrom = 0,
|
|
|
|
sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
|
|
|
|
: SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
|
2014-06-27 12:27:55 +00:00
|
|
|
, mbStayAssignedToListLevelOfOutlineStyle(false)
|
|
|
|
, mbAssignedToOutlineStyle(false)
|
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
pNextTextFormatColl = this;
|
2014-06-27 12:27:55 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// To get UL- / LR- / FontHeight-changes.
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
|
2010-12-17 09:02:23 +01:00
|
|
|
|
|
|
|
public:
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-26 11:54:10 +01:00
|
|
|
TYPEINFO_OVERRIDE(); ///< Already in base class Client.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
|
|
|
|
SwTextFormatColl& GetNextTextFormatColl() const { return *pNextTextFormatColl; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-11-08 12:16:44 +09:00
|
|
|
bool IsAtDocNodeSet() const;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2009-01-07 11:57:24 +00:00
|
|
|
void SetAttrOutlineLevel( int );
|
|
|
|
int GetAttrOutlineLevel() const;
|
2014-06-27 12:27:55 +00:00
|
|
|
|
|
|
|
// Return the list level of the Outline Style - the List Style for the
|
|
|
|
// outline numbering -
|
|
|
|
// to which the Paragraph Style is assigned.
|
2009-01-07 11:57:24 +00:00
|
|
|
int GetAssignedOutlineStyleLevel() const;
|
2014-06-27 12:27:55 +00:00
|
|
|
|
2009-04-01 13:20:55 +00:00
|
|
|
inline bool IsAssignedToListLevelOfOutlineStyle() const
|
2007-01-23 07:29:35 +00:00
|
|
|
{
|
2009-01-07 11:57:24 +00:00
|
|
|
return mbAssignedToOutlineStyle;
|
2007-01-23 07:29:35 +00:00
|
|
|
}
|
2014-06-27 12:27:55 +00:00
|
|
|
|
|
|
|
// If a Paragraph Style is assigned to list level N of the Outline Style,
|
|
|
|
// then its outline level - AttrOutlineLevel - is set to N+1
|
2009-01-07 11:57:24 +00:00
|
|
|
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
|
2014-06-27 12:27:55 +00:00
|
|
|
void DeleteAssignmentToListLevelOfOutlineStyle(const bool bResetOutlineLevel
|
|
|
|
= true);
|
2007-01-23 07:29:35 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/** Override to recognize changes on the <SwNumRuleItem> and register/unregister
|
|
|
|
the paragragh style at the corresponding <SwNumRule> instance. */
|
2015-05-20 13:05:49 +02:00
|
|
|
virtual bool SetFormatAttr( const SfxPoolItem& rAttr ) SAL_OVERRIDE;
|
|
|
|
virtual bool SetFormatAttr( const SfxItemSet& rSet ) SAL_OVERRIDE;
|
|
|
|
virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) SAL_OVERRIDE;
|
2008-06-13 08:26:34 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
/// Override <ResetAllFormatAttr()> to stay assigned to list level of outline style.
|
|
|
|
virtual sal_uInt16 ResetAllFormatAttr() SAL_OVERRIDE;
|
2007-02-05 09:51:35 +00:00
|
|
|
|
|
|
|
inline bool StayAssignedToListLevelOfOutlineStyle() const
|
|
|
|
{
|
|
|
|
return mbStayAssignedToListLevelOfOutlineStyle;
|
|
|
|
}
|
2008-03-05 15:48:56 +00:00
|
|
|
|
|
|
|
bool AreListLevelIndentsApplicable() const;
|
2015-02-13 09:09:40 +01:00
|
|
|
|
|
|
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwGrfFormatColl: public SwFormatColl
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend class SwDoc;
|
|
|
|
protected:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwGrfFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
|
|
|
|
SwGrfFormatColl* pDerFrom = 0 )
|
|
|
|
: SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
|
2000-09-18 16:15:01 +00:00
|
|
|
pDerFrom, RES_GRFFMTCOLL )
|
|
|
|
{}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
|
|
|
|
SwGrfFormatColl* pDerFrom = 0 )
|
|
|
|
: SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
|
2000-09-18 16:15:01 +00:00
|
|
|
pDerFrom, RES_GRFFMTCOLL )
|
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
2014-03-26 11:54:10 +01:00
|
|
|
TYPEINFO_OVERRIDE(); ///< Already in base class Client.
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2011-02-02 17:23:50 +01:00
|
|
|
// FEATURE::CONDCOLL
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Conditional styles.
|
2000-09-18 16:15:01 +00:00
|
|
|
enum Master_CollConditions
|
|
|
|
{
|
|
|
|
PARA_IN_LIST = 0x0001,
|
|
|
|
PARA_IN_OUTLINE = 0x0002,
|
|
|
|
PARA_IN_FRAME = 0x0004,
|
|
|
|
PARA_IN_TABLEHEAD = 0x0008,
|
|
|
|
PARA_IN_TABLEBODY = 0x0010,
|
|
|
|
PARA_IN_SECTION = 0x0020,
|
|
|
|
PARA_IN_FOOTENOTE = 0x0040,
|
|
|
|
PARA_IN_FOOTER = 0x0080,
|
|
|
|
PARA_IN_HEADER = 0x0100,
|
|
|
|
PARA_IN_ENDNOTE = 0x0200,
|
2014-02-25 21:01:20 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
USRFLD_EXPRESSION = (int)0x8000
|
|
|
|
};
|
|
|
|
|
2004-08-23 07:32:29 +00:00
|
|
|
class SW_DLLPUBLIC SwCollCondition : public SwClient
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nCondition;
|
2000-09-18 16:15:01 +00:00
|
|
|
union
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nSubCondition;
|
2015-05-20 13:05:49 +02:00
|
|
|
OUString* pFieldExpression;
|
2000-09-18 16:15:01 +00:00
|
|
|
} aSubCondition;
|
|
|
|
|
|
|
|
public:
|
2014-03-26 11:54:10 +01:00
|
|
|
TYPEINFO_OVERRIDE(); ///< Already in base class Client.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwCollCondition( SwTextFormatColl* pColl, sal_uLong nMasterCond,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nSubCond = 0 );
|
2015-05-20 13:05:49 +02:00
|
|
|
SwCollCondition( SwTextFormatColl* pColl, sal_uLong nMasterCond,
|
2013-10-10 15:32:40 +02:00
|
|
|
const OUString& rSubExp );
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual ~SwCollCondition();
|
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// @@@ public copy ctor, but no copy assignment?
|
2004-08-23 07:32:29 +00:00
|
|
|
SwCollCondition( const SwCollCondition& rCpy );
|
|
|
|
private:
|
2012-09-02 09:05:03 +03:00
|
|
|
/// @@@ public copy ctor, but no copy assignment?
|
2015-02-07 12:31:51 +01:00
|
|
|
SwCollCondition & operator= (const SwCollCondition &) SAL_DELETED_FUNCTION;
|
2004-08-23 07:32:29 +00:00
|
|
|
public:
|
|
|
|
|
2014-01-17 17:11:45 +01:00
|
|
|
bool operator==( const SwCollCondition& rCmp ) const;
|
|
|
|
bool operator!=( const SwCollCondition& rCmp ) const
|
2000-09-18 16:15:01 +00:00
|
|
|
{ return ! (*this == rCmp); }
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong GetCondition() const { return nCondition; }
|
|
|
|
sal_uLong GetSubCondition() const { return aSubCondition.nSubCondition; }
|
2015-05-20 13:05:49 +02:00
|
|
|
const OUString* GetFieldExpression() const
|
|
|
|
{ return aSubCondition.pFieldExpression; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetCondition( sal_uLong nCond, sal_uLong nSubCond );
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); }
|
|
|
|
void RegisterToFormat( SwFormat& );
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwFormatCollConditions : public boost::ptr_vector<SwCollCondition> {};
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SW_DLLPUBLIC SwConditionTextFormatColl : public SwTextFormatColl
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend class SwDoc;
|
2014-08-08 19:16:38 +02:00
|
|
|
friend class ::sw::DocumentStylePoolManager;
|
2000-09-18 16:15:01 +00:00
|
|
|
protected:
|
2015-05-20 13:05:49 +02:00
|
|
|
SwFormatCollConditions aCondColls;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
SwConditionTextFormatColl( SwAttrPool& rPool, const sal_Char* pFormatCollName,
|
|
|
|
SwTextFormatColl* pDerFrom = 0 )
|
|
|
|
: SwTextFormatColl( rPool, pFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{}
|
2015-05-20 13:05:49 +02:00
|
|
|
SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
|
|
|
|
SwTextFormatColl* pDerFrom = 0 )
|
|
|
|
: SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
2014-03-26 11:54:10 +01:00
|
|
|
TYPEINFO_OVERRIDE(); ///< Already in base class Client.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
virtual ~SwConditionTextFormatColl();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwFormatCollConditions& GetCondColls() const { return aCondColls; }
|
2000-09-18 16:15:01 +00:00
|
|
|
void InsertCondition( const SwCollCondition& rCond );
|
2012-11-08 12:16:44 +09:00
|
|
|
bool RemoveCondition( const SwCollCondition& rCond );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
void SetConditions( const SwFormatCollConditions& );
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
2011-02-02 17:23:50 +01:00
|
|
|
// FEATURE::CONDCOLL
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Inline implementations.
|
2015-05-20 13:05:49 +02:00
|
|
|
inline void SwTextFormatColl::SetNextTextFormatColl( SwTextFormatColl& rNext )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
pNextTextFormatColl = &rNext;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|