2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 09:59:59 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _DOCSTYLE_HXX
|
|
|
|
#define _DOCSTYLE_HXX
|
|
|
|
|
2008-03-12 11:11:41 +00:00
|
|
|
#include <rtl/ref.hxx>
|
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/style.hxx>
|
|
|
|
#include <svl/itemset.hxx>
|
2004-08-23 07:30:36 +00:00
|
|
|
#include "swdllapi.h"
|
2012-01-14 00:33:41 -05:00
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
2004-08-23 07:30:36 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
class SwDoc;
|
|
|
|
class SwDocStyleSheetPool;
|
|
|
|
class SwPageDesc;
|
|
|
|
class SwCharFmt;
|
|
|
|
class SwTxtFmtColl;
|
|
|
|
class SwFrmFmt;
|
|
|
|
class SwNumRule;
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
2011-01-12 10:32:43 +01:00
|
|
|
Local helper class.
|
2000-09-18 16:15:01 +00:00
|
|
|
--------------------------------------------------------------------*/
|
2012-01-13 17:17:39 -05:00
|
|
|
class SwPoolFmtList : public std::vector<String>
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SwPoolFmtList() {}
|
|
|
|
void Append( char cChar, const String& rStr );
|
|
|
|
void Erase();
|
|
|
|
};
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
2011-01-12 10:32:43 +01:00
|
|
|
Temporary StyleSheet.
|
2000-09-18 16:15:01 +00:00
|
|
|
--------------------------------------------------------------------*/
|
2004-08-23 07:30:36 +00:00
|
|
|
class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
friend class SwDocStyleSheetPool;
|
|
|
|
friend class SwStyleSheetIterator;
|
|
|
|
|
|
|
|
SwCharFmt* pCharFmt;
|
|
|
|
SwTxtFmtColl* pColl;
|
|
|
|
SwFrmFmt* pFrmFmt;
|
|
|
|
const SwPageDesc* pDesc;
|
|
|
|
const SwNumRule* pNumRule;
|
|
|
|
|
|
|
|
SwDoc& rDoc;
|
|
|
|
SfxItemSet aCoreSet;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bPhysical;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Make empty shell a real StyleSheet (Core).
|
2004-08-23 07:30:36 +00:00
|
|
|
SW_DLLPRIVATE void Create();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// Fill StyleSheet with data.
|
2000-09-18 16:15:01 +00:00
|
|
|
enum FillStyleType {
|
|
|
|
FillOnlyName,
|
|
|
|
FillAllInfo,
|
|
|
|
FillPhysical
|
|
|
|
};
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SW_DLLPRIVATE sal_Bool FillStyleSheet( FillStyleType eFType );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2008-03-12 11:11:41 +00:00
|
|
|
protected:
|
|
|
|
virtual ~SwDocStyleSheet();
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
|
|
|
SwDocStyleSheet( SwDoc& rDoc,
|
|
|
|
const String& rName,
|
2012-02-27 16:18:34 +00:00
|
|
|
SwDocStyleSheetPool* pPool,
|
2000-09-18 16:15:01 +00:00
|
|
|
SfxStyleFamily eFam,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nMask);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
SwDocStyleSheet( const SwDocStyleSheet& );
|
|
|
|
|
|
|
|
void Reset();
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetMask(sal_uInt16 nMsk) { nMask = nMsk; }
|
2000-09-18 16:15:01 +00:00
|
|
|
void SetFamily(SfxStyleFamily eFam) { nFamily = eFam; }
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsPhysical() const { return bPhysical; }
|
|
|
|
void SetPhysical(sal_Bool bPhys);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
|
|
|
|
which indicates that the indent attributes at a paragraph style should
|
|
|
|
be reset in case that a list style is applied to the paragraph style and
|
|
|
|
no indent attributes are applied. */
|
2008-03-05 15:48:05 +00:00
|
|
|
void SetItemSet( const SfxItemSet& rSet,
|
|
|
|
const bool bResetIndentAttrsAtParagraphStyle = false );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
virtual SfxItemSet& GetItemSet();
|
2012-09-02 09:05:03 +03:00
|
|
|
/** new method for paragraph styles to merge indent attributes of applied list
|
|
|
|
style into the given item set, if the list style indent attributes are applicable. */
|
2008-03-05 15:48:05 +00:00
|
|
|
void MergeIndentAttrsOfListStyle( SfxItemSet& rSet );
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual const String& GetParent() const;
|
|
|
|
virtual const String& GetFollow() const;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual sal_uLong GetHelpId( String& rFile );
|
|
|
|
virtual void SetHelpId( const String& r, sal_uLong nId );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/** Preset the members without physical access.
|
|
|
|
Used by StyleSheetPool. */
|
2000-09-18 16:15:01 +00:00
|
|
|
void PresetName(const String& rName) { aName = rName; }
|
|
|
|
void PresetNameAndFamily(const String& rName);
|
|
|
|
void PresetParent(const String& rName){ aParent = rName; }
|
|
|
|
void PresetFollow(const String& rName){ aFollow = rName; }
|
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
virtual bool SetName( const String& rStr);
|
|
|
|
virtual bool SetParent( const String& rStr);
|
|
|
|
virtual bool SetFollow( const String& rStr);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
virtual bool HasFollowSupport() const;
|
|
|
|
virtual bool HasParentSupport() const;
|
|
|
|
virtual bool HasClearParentSupport() const;
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual String GetDescription();
|
|
|
|
virtual String GetDescription(SfxMapUnit eUnit);
|
|
|
|
|
|
|
|
SwCharFmt* GetCharFmt();
|
|
|
|
SwTxtFmtColl* GetCollection();
|
|
|
|
SwFrmFmt* GetFrmFmt();
|
|
|
|
const SwPageDesc* GetPageDesc();
|
|
|
|
const SwNumRule* GetNumRule();
|
|
|
|
void SetNumRule(const SwNumRule& rRule);
|
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
virtual bool IsUsed() const;
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
2011-01-12 10:32:43 +01:00
|
|
|
Iterator for Pool.
|
2000-09-18 16:15:01 +00:00
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
|
|
|
|
{
|
2008-03-12 11:11:41 +00:00
|
|
|
rtl::Reference< SwDocStyleSheet > mxIterSheet;
|
|
|
|
rtl::Reference< SwDocStyleSheet > mxStyleSheet;
|
2000-09-18 16:15:01 +00:00
|
|
|
SwPoolFmtList aLst;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nLastPos;
|
|
|
|
sal_Bool bFirstCalled;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-01-14 00:33:41 -05:00
|
|
|
void AppendStyleList(const boost::ptr_vector<String>& rLst,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bUsed,
|
|
|
|
sal_uInt16 nSection,
|
2000-09-18 16:15:01 +00:00
|
|
|
char cType);
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
|
2011-01-17 15:06:54 +01:00
|
|
|
SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual ~SwStyleSheetIterator();
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual sal_uInt16 Count();
|
|
|
|
virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual SfxStyleSheetBase* First();
|
|
|
|
virtual SfxStyleSheetBase* Next();
|
2012-04-11 00:28:56 +01:00
|
|
|
virtual SfxStyleSheetBase* Find(const rtl::OUString& rStr);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
virtual void Notify( SfxBroadcaster&, const SfxHint& );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SwDocStyleSheetPool : public SfxStyleSheetBasePool
|
|
|
|
{
|
2008-03-12 11:11:41 +00:00
|
|
|
rtl::Reference< SwDocStyleSheet > mxStyleSheet;
|
2000-09-18 16:15:01 +00:00
|
|
|
SwDoc& rDoc;
|
2012-09-02 09:05:03 +03:00
|
|
|
sal_Bool bOrganizer : 1; ///< Organizer
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual SfxStyleSheetBase* Create( const String&, SfxStyleFamily, sal_uInt16 nMask);
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
|
2007-10-22 14:04:48 +00:00
|
|
|
|
|
|
|
using SfxStyleSheetBasePool::Find;
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
public:
|
2011-01-17 15:06:54 +01:00
|
|
|
SwDocStyleSheetPool( SwDoc&, sal_Bool bOrganizer = sal_False );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
virtual void Replace( SfxStyleSheetBase& rSource,
|
|
|
|
SfxStyleSheetBase& rTarget );
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
|
2007-09-27 06:59:57 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 n=0xFFFF );
|
2007-09-27 06:59:57 +00:00
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
virtual bool SetParent( SfxStyleFamily eFam, const String &rStyle,
|
2000-09-18 16:15:01 +00:00
|
|
|
const String &rParent );
|
|
|
|
|
2008-03-12 11:11:41 +00:00
|
|
|
virtual void Remove( SfxStyleSheetBase* pStyle);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetOrganizerMode( sal_Bool bMode ) { bOrganizer = bMode; }
|
|
|
|
sal_Bool IsOrganizerMode() const { return bOrganizer; }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nMask );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
SwDoc& GetDoc() const { return rDoc; }
|
|
|
|
|
2008-03-12 11:11:41 +00:00
|
|
|
void dispose();
|
|
|
|
|
|
|
|
virtual void SAL_CALL acquire( ) throw ();
|
|
|
|
virtual void SAL_CALL release( ) throw ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~SwDocStyleSheetPool();
|
|
|
|
|
2012-09-02 09:05:03 +03:00
|
|
|
/// For not-so-clever compilers.
|
2000-09-18 16:15:01 +00:00
|
|
|
private:
|
|
|
|
SwDocStyleSheetPool( const SwDocStyleSheetPool& );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|