loplugin:mergeclasses ImplEESdrWriter with ImplEscherExSdr

Change-Id: Iea2241d9fc44b92e18101b3f367a643f03729183
This commit is contained in:
Noel Grandin
2016-10-13 13:30:27 +02:00
parent 7bc5d17be6
commit a7e395f397
5 changed files with 51 additions and 82 deletions

View File

@@ -71,7 +71,6 @@ merge IXFAttrList with XFSaxAttrList
merge IXFStream with XFSaxStream
merge IXFStyle with XFStyle
merge IconChoicePage with SvxHyperlinkTabPageBase
merge ImplEESdrWriter with ImplEscherExSdr
merge ImplGlyphFallbackFontSubstitution with FcGlyphFallbackSubstitution
merge ImplPreMatchFontSubstitution with FcPreMatchSubstitution
merge LwpDLList with LwpParaProperty

View File

@@ -4975,7 +4975,7 @@ EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pO
mbOwnsStrm = true;
}
mnStrmStartOfs = mpOutStrm->Tell();
mpImplEscherExSdr.reset( new ImplEscherExSdr( *this ) );
mpImplEESdrWriter.reset( new ImplEESdrWriter( *this ) );
}
EscherEx::~EscherEx()
@@ -5295,7 +5295,7 @@ sal_uInt32 EscherEx::EnterGroup( const OUString& rShapeName, const Rectangle* pB
if ( mnGroupLevel > 1 )
AddChildAnchor( aRect );
EscherExHostAppData* pAppData = mpImplEscherExSdr->ImplGetHostData();
EscherExHostAppData* pAppData = mpImplEESdrWriter->ImplGetHostData();
if( pAppData )
{
if ( mnGroupLevel <= 1 )

View File

@@ -69,9 +69,13 @@ ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx )
, mpPicStrm(nullptr)
, mpHostAppData(nullptr)
, mbIsTitlePossible(false)
, mpSdrPage( nullptr )
, mpSolverContainer( nullptr )
{
}
Point ImplEESdrWriter::ImplMapPoint( const Point& rPoint )
{
return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest );
@@ -833,18 +837,9 @@ void ImplEESdrWriter::ImplWritePage(
}
}
ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx )
:
ImplEESdrWriter( rEx ),
mpSdrPage( nullptr ),
mpSolverContainer( nullptr )
ImplEESdrWriter::~ImplEESdrWriter()
{
}
ImplEscherExSdr::~ImplEscherExSdr()
{
DBG_ASSERT( !mpSolverContainer, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" );
DBG_ASSERT( !mpSolverContainer, "ImplEESdrWriter::~ImplEESdrWriter: unwritten SolverContainer" );
Reference<css::lang::XComponent> xComp(mXDrawPage, UNO_QUERY);
if (xComp.is())
xComp->dispose();
@@ -852,7 +847,7 @@ ImplEscherExSdr::~ImplEscherExSdr()
}
bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage )
bool ImplEESdrWriter::ImplInitPage( const SdrPage& rPage )
{
SvxDrawPage* pSvxDrawPage;
if ( mpSdrPage != &rPage || !mXDrawPage.is() )
@@ -880,7 +875,7 @@ bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage )
return pSvxDrawPage != nullptr;
}
bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
bool ImplEESdrWriter::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
{
// eventually write SolverContainer of current page, deletes the Solver
ImplFlushSolverContainer();
@@ -899,7 +894,7 @@ bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
return true;
}
void ImplEscherExSdr::ImplExitPage()
void ImplEESdrWriter::ImplExitPage()
{
// close all groups before the solver container is written
while( mpEscherEx->GetGroupLevel() )
@@ -910,7 +905,7 @@ void ImplEscherExSdr::ImplExitPage()
}
void ImplEscherExSdr::ImplFlushSolverContainer()
void ImplEESdrWriter::ImplFlushSolverContainer()
{
if ( mpSolverContainer )
{
@@ -920,43 +915,43 @@ void ImplEscherExSdr::ImplFlushSolverContainer()
}
}
void ImplEscherExSdr::ImplWriteCurrentPage()
void ImplEESdrWriter::ImplWriteCurrentPage()
{
assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer");
assert(mpSolverContainer && "ImplEESdrWriter::ImplWriteCurrentPage: no SolverContainer");
ImplWritePage( *mpSolverContainer );
ImplExitPage();
}
sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxmlExport )
sal_uInt32 ImplEESdrWriter::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxmlExport )
{
assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteShape: no SolverContainer");
assert(mpSolverContainer && "ImplEESdrWriter::ImplWriteShape: no SolverContainer");
return ImplWriteShape( rObj, *mpSolverContainer, ooxmlExport );
}
void EscherEx::AddSdrPage( const SdrPage& rPage )
{
if ( mpImplEscherExSdr->ImplInitPage( rPage ) )
mpImplEscherExSdr->ImplWriteCurrentPage();
if ( mpImplEESdrWriter->ImplInitPage( rPage ) )
mpImplEESdrWriter->ImplWriteCurrentPage();
}
void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes )
{
if ( mpImplEscherExSdr->ImplInitUnoShapes( rxShapes ) )
mpImplEscherExSdr->ImplWriteCurrentPage();
if ( mpImplEESdrWriter->ImplInitUnoShapes( rxShapes ) )
mpImplEESdrWriter->ImplWriteCurrentPage();
}
sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj, bool ooxmlExport )
{
ImplEESdrObject aObj( *mpImplEscherExSdr, rObj, mbOOXML );
ImplEESdrObject aObj( *mpImplEESdrWriter, rObj, mbOOXML );
if( aObj.IsValid() )
return mpImplEscherExSdr->ImplWriteTheShape( aObj, ooxmlExport );
return mpImplEESdrWriter->ImplWriteTheShape( aObj, ooxmlExport );
return 0;
}
void EscherEx::EndSdrObjectPage()
{
mpImplEscherExSdr->ImplExitPage();
mpImplEESdrWriter->ImplExitPage();
}
EscherExHostAppData* EscherEx::StartShape( const Reference< XShape >& /* rShape */, const Rectangle* /*pChildAnchor*/ )
@@ -999,7 +994,7 @@ const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
}
ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr& rEx,
ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
const SdrObject& rObj, bool bOOXML ) :
mnShapeId( 0 ),
mnTextSize( 0 ),

View File

@@ -29,7 +29,9 @@
enum ImplEESdrPageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
class ImplEESdrWriter;
class ImplEscherExSdr;
class ImplEESdrWriter;
class SdrObject;
class SdrPage;
class ImplEESdrObject
{
@@ -50,7 +52,7 @@ class ImplEESdrObject
public:
css::uno::Reference< css::beans::XPropertySet > mXPropSet;
ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj, bool bOOXML = false );
ImplEESdrObject( ImplEESdrWriter& rEx, const SdrObject& rObj, bool bOOXML = false );
ImplEESdrObject( ImplEESdrWriter& rEx, const css::uno::Reference< css::drawing::XShape >& rShape );
~ImplEESdrObject();
@@ -106,70 +108,43 @@ class EscherExHostAppData;
class ImplEESdrWriter
{
protected:
EscherEx* mpEscherEx;
MapMode maMapModeSrc;
MapMode maMapModeDest;
css::uno::Reference< css::drawing::XDrawPage > mXDrawPage;
css::uno::Reference< css::drawing::XShapes > mXShapes;
SvStream* mpPicStrm;
// own extensions
EscherExHostAppData* mpHostAppData;
bool mbIsTitlePossible;
explicit ImplEESdrWriter( EscherEx& rEx );
bool ImplInitPageValues();
void ImplWritePage(
EscherSolverContainer& rSolver );
sal_uInt32 ImplWriteShape( ImplEESdrObject& rObj,
EscherSolverContainer& rSolver,
const bool bOOxmlExport = false ); // returns ShapeID
static void ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
void ImplWriteAdditionalText(
ImplEESdrObject& rObj,
const Point& rTextRefPoint );
sal_uInt32 ImplEnterAdditionalTextGroup(
const css::uno::Reference< css::drawing::XShape >& rShape,
const Rectangle* pBoundRect );
public:
Point ImplMapPoint( const Point& rPoint );
Size ImplMapSize( const Size& rSize );
EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
};
class SdrObject;
class SdrPage;
class ImplEscherExSdr : public ImplEESdrWriter
{
private:
const SdrPage* mpSdrPage;
EscherSolverContainer* mpSolverContainer;
public:
explicit ImplEscherExSdr( EscherEx& rEx );
virtual ~ImplEscherExSdr();
bool ImplInitPageValues();
void ImplWritePage( EscherSolverContainer& rSolver );
sal_uInt32 ImplWriteShape( ImplEESdrObject& rObj,
EscherSolverContainer& rSolver,
const bool bOOxmlExport = false ); // returns ShapeID
static void ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt );
void ImplWriteAdditionalText(
ImplEESdrObject& rObj,
const Point& rTextRefPoint );
sal_uInt32 ImplEnterAdditionalTextGroup(
const css::uno::Reference< css::drawing::XShape >& rShape,
const Rectangle* pBoundRect );
void ImplFlushSolverContainer();
public:
explicit ImplEESdrWriter( EscherEx& rEx );
~ImplEESdrWriter();
Point ImplMapPoint( const Point& rPoint );
Size ImplMapSize( const Size& rSize );
EscherExHostAppData* ImplGetHostData() { return mpHostAppData; }
bool ImplInitPage( const SdrPage& rPage );
bool ImplInitUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes );
void ImplWriteCurrentPage();
sal_uInt32 ImplWriteTheShape( ImplEESdrObject& rObj, bool ooxmlExport );
void ImplExitPage();
void ImplFlushSolverContainer();
};

View File

@@ -966,7 +966,7 @@ public:
void WriteDggAtom( SvStream& rStrm ) const;
/** Called if a picture shall be written and no picture stream is set at
class ImplEscherExSdr.
class ImplEESdrWriter.
On first invokation, this function calls the virtual member function
ImplQueryPictureStream(). The return value will be cached internally
@@ -1015,13 +1015,13 @@ private:
class SdrObject;
class SdrPage;
class ImplEscherExSdr;
class ImplEESdrWriter;
class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
{
protected:
std::shared_ptr<EscherExGlobal> mxGlobal;
::std::unique_ptr< ImplEscherExSdr > mpImplEscherExSdr;
::std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter;
SvStream* mpOutStrm;
bool mbOwnsStrm;
sal_uInt32 mnStrmStartOfs;
@@ -1056,7 +1056,7 @@ public:
EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
/** Called if a picture shall be written and no picture stream is set at
class ImplEscherExSdr.
class ImplEESdrWriter.
*/
inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }