LibreOffice Module sw (master) 1
Public Types | Public Member Functions | Private Attributes | List of all members
sw::util::ParaStyleMapper Class Reference

Knows which writer style a given word style should be imported as. More...

#include <msfilter.hxx>

Public Types

typedef std::pair< SwTextFormatColl *, bool > StyleResult
 StyleResult StyleResult is a std::pair of a pointer to a style and a flag which is true if the style existed previously in the document. More...
 

Public Member Functions

 ParaStyleMapper (SwDoc &rDoc)
 
 ~ParaStyleMapper ()
 
StyleResult GetStyle (const OUString &rName, ww::sti eSti, std::map< OUString, sal_Int32 > &rCollisions)
 Get the writer style which the word style should map to. More...
 

Private Attributes

std::unique_ptr<::myImplHelpers::StyleMapperImpl< SwTextFormatColl > > mpImpl
 

Detailed Description

Knows which writer style a given word style should be imported as.

Mapping a word style to a writer style has to consider mapping the word builtin styles like "Normal" as the default root style to our default root style which is called "Default" in english, and "Normal" in german.

Additionally it then has to avoid name collisions such as

a) styles "Normal" and "Default" in a single document, where we can use the original distinct names "Normal" and "Default" and... b) styles "Normal" and "Default" in a single document, where we can not use the original names, and must come up with an alternative name for one of them...

And it needs to report to the importer if the style being mapped to was already in existence, for the cut and paste/insert file mode we should not modify the returned style if it is already in use as it does not belong to us to change.

Definition at line 140 of file msfilter.hxx.

Member Typedef Documentation

◆ StyleResult

StyleResult StyleResult is a std::pair of a pointer to a style and a flag which is true if the style existed previously in the document.

Definition at line 153 of file msfilter.hxx.

Constructor & Destructor Documentation

◆ ParaStyleMapper()

sw::util::ParaStyleMapper::ParaStyleMapper ( SwDoc rDoc)
explicit

Definition at line 468 of file writerwordglue.cxx.

◆ ~ParaStyleMapper()

sw::util::ParaStyleMapper::~ParaStyleMapper ( )

Definition at line 473 of file writerwordglue.cxx.

Member Function Documentation

◆ GetStyle()

ParaStyleMapper::StyleResult sw::util::ParaStyleMapper::GetStyle ( const OUString &  rName,
ww::sti  eSti,
std::map< OUString, sal_Int32 > &  rCollisions 
)

Get the writer style which the word style should map to.

Parameters
rNameThe name of the word style
eStiThe style id of the word style, we are really only interested in knowing if the style has either a builtin standard id, or is a user defined style.
rCollisionsCache of previous name collisions to speed up resolution of later duplicates.
Returns
The equivalent writer style packaged as a StyleResult to use for this word style.

It will only return a failure in the pathological case of catastrophic failure elsewhere of there exist already styles rName and WW-rName[0..SAL_MAX_INT32], which is both unlikely and impossible.

Definition at line 477 of file writerwordglue.cxx.

References mpImpl.

Referenced by WW8RStyle::PrepareStyle().

Member Data Documentation

◆ mpImpl

std::unique_ptr<::myImplHelpers::StyleMapperImpl<SwTextFormatColl> > sw::util::ParaStyleMapper::mpImpl
private

Definition at line 144 of file msfilter.hxx.

Referenced by GetStyle().


The documentation for this class was generated from the following files: