svx/workben/msview/makefile.mk | 62 -- svx/workben/msview/msview.cxx | 1154 --------------------------------------- svx/workben/msview/msview.xml | 311 ---------- svx/workben/msview/xmlconfig.cxx | 557 ------------------ svx/workben/msview/xmlconfig.hxx | 125 ---- svx/workben/pixelctl.cxx | 168 ----- 6 files changed, 2377 deletions(-)
New commits: commit 392809bb6c87260761adbfa15dc475657bccbaf3 Author: David Tardon <dtar...@redhat.com> Date: Tue Jul 21 08:59:20 2015 +0200 drop obsolete code Change-Id: I741c5f5ed895b06a445f42e20ef004a8c7c1a100 diff --git a/svx/workben/msview/makefile.mk b/svx/workben/msview/makefile.mk deleted file mode 100644 index 95fb964..0000000 --- a/svx/workben/msview/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -# -# 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 . -# - -PRJ=..$/.. - -PRJNAME=svx -TARGET=msview -LIBTARGET=NO -TARGETTYPE=GUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - - -# --- Files -------------------------------------------------------- - -OBJFILES= $(OBJ)$/msview.obj \ - $(OBJ)$/xmlconfig.obj -EXCEPTIONSFILES=$(OBJ)$/msview.obj \ - $(OBJ)$/xmlconfig.obj - -APP1NOSAL= TRUE -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJFILES) - -APP1STDLIBS= $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(SVTOOLLIB) \ - $(SALLIB) \ - $(SOTLIB) \ - $(VCLLIB) \ - $(SVXLIB) \ - $(SFXLIB) - - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx deleted file mode 100644 index aff2e4e..0000000 --- a/svx/workben/msview/msview.cxx +++ /dev/null @@ -1,1154 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - - -#include <vector> -#include <map> -#include <algorithm> -#include <boost/shared_ptr.hpp> -#include <sot/storage.hxx> -#include <svtools/svtools.hrc> - -#include <sal/main.h> -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <vcl/button.hxx> -#include <vcl/lstbox.hxx> -#include <svtools/filectrl.hxx> -#include <tools/urlobj.hxx> -#include <osl/file.hxx> -#include <vcl/unohelp2.hxx> -#include <svtools/treelistbox.hxx> -#include <svtools/svmedit.hxx> -#include <sfx2/filedlghelper.hxx> - -#include <toolkit/helper/vclunohelper.hxx> - -#include <tools/stream.hxx> -#include <tools/resmgr.hxx> - -#include <comphelper/processfactory.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/bootstrap.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/awt/WindowDescriptor.hpp> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <svx/msdffdef.hxx> - -#include <unotools/localfilehelper.hxx> - -#include "xmlconfig.hxx" - - -using namespace ::com::sun::star; - - - -enum CompareStatus { CMP_NOTYET = 0, CMP_EQUAL = 1, CMP_NOTEQUAL = 2, CMP_NOTAVAILABLE = 3 }; -static ColorData gColors[] = { COL_BLACK, COL_GREEN, COL_RED, COL_CYAN }; - -class Atom -{ -public: - ~Atom(); - - /** imports this atom and its child atoms */ - static Atom* import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl ); - static Atom* import( UINT16 nRecType, SvStream& rStCtrl ); - - inline const DffRecordHeader& getHeader() const; - - /** returns true if at least one atom with the given nRecType is found */ - inline bool hasChildAtom( sal_uInt16 nRecType ) const; - - /** returns true if at least one atom with the given nRecType and nRecInstnace is found */ - inline bool hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const; - - /** returns the first child atom with nRecType or NULL */ - inline const Atom* findFirstChildAtom( sal_uInt16 nRecType ) const; - - /** returns the next child atom after pLast with nRecType or NULL */ - const Atom* findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const; - - /** returns the first child atom with nRecType and nRecInstance or NULL */ - inline const Atom* findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const; - - /** returns the next child atom after pLast with nRecType and nRecInstance or NULL */ - const Atom* findNextChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance, const Atom* pLast ) const; - - /** returns the first child atom or NULL */ - inline const Atom* findFirstChildAtom() const; - - /** returns the next child atom after pLast or NULL */ - inline const Atom* findNextChildAtom( const Atom* pLast ) const; - - /** returns true if this atom is a container */ - inline bool isContainer() const; - - /** seeks to the contents of this atom */ - inline bool seekToContent() const; - - /** returns the record type */ - inline sal_uInt16 getType() const; - - /** returns the record instance */ - inline sal_uInt16 getInstance() const; - - /** returns the record length */ - inline sal_uInt32 getLength() const; - - SvStream& getStream() const { return mrStream; } - - bool operator==( const Atom& rAtom ) const; - - CompareStatus getCompareStatus() const { return meStatus; } - - void compare( Atom* pAtom ); - bool compareContent( Atom& rAtom ); - - Atom* getCompareAtom() const { return mpCompareAtom; } - void setCompareAtom( Atom* pAtom ) { mpCompareAtom = pAtom; } - -private: - Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl ); - - // statics for compare - static Atom* skipAtoms( Atom* pContainer, Atom* pAtom, Atom* pSkipTo ); - static Atom* findFirstEqualAtom( Atom* pCompare, Atom* pContainer, Atom* pSearch, int& nDistance ); - - SvStream& mrStream; - DffRecordHeader maRecordHeader; - Atom* mpFirstChild; - Atom* mpNextAtom; - - CompareStatus meStatus; - Atom* mpCompareAtom; -}; - -bool Atom::operator==( const Atom& rAtom ) const -{ - return ( maRecordHeader.nRecType == rAtom.maRecordHeader.nRecType ) && - ( maRecordHeader.nRecVer == rAtom.maRecordHeader.nRecVer ) && - ( maRecordHeader.nRecInstance == rAtom.maRecordHeader.nRecInstance ); -} - -bool Atom::compareContent( Atom& rAtom ) -{ - if( maRecordHeader.nRecLen == rAtom.maRecordHeader.nRecLen ) - { - seekToContent(); - rAtom.seekToContent(); - - SvStream& rStream1 = getStream(); - SvStream& rStream2 = rAtom.getStream(); - - const int nBufferSize = 1024; - boost::shared_ptr< char > buffer1( new char[nBufferSize] ); - boost::shared_ptr< char > buffer2( new char[nBufferSize] ); - - sal_uInt32 nLength = maRecordHeader.nRecLen; - sal_Size nRead = 0; - while( nLength ) - { - sal_Size nRead = (nBufferSize < nLength) ? nBufferSize : nLength; - nRead = rStream1.Read( (void*)buffer1.get(), nRead ); - if( nRead == 0 ) - break; - if( rStream2.Read( (void*)buffer2.get(), nRead ) != nRead ) - break; - if( memcmp( (void*)buffer1.get(), (void*)buffer2.get(), nRead ) != 0 ) - break; - - nLength -= nRead; - } - - return nLength == 0; - } - - return false; -} - -inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const -{ - return findFirstChildAtom( nRecType ) != NULL; -} - -inline bool Atom::hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const -{ - return findFirstChildAtom( nRecType, nRecInstance ) != NULL; -} - -inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType ) const -{ - return findNextChildAtom( nRecType, NULL ); -} - -inline const DffRecordHeader& Atom::getHeader() const -{ - return maRecordHeader; -} - -inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const -{ - return findNextChildAtom( nRecType, nRecInstance, NULL ); -} - -inline const Atom* Atom::findFirstChildAtom() const -{ - return mpFirstChild; -} - -inline const Atom* Atom::findNextChildAtom( const Atom* pLast ) const -{ - return pLast ? pLast->mpNextAtom : pLast; -} - -inline bool Atom::isContainer() const -{ - return (bool)maRecordHeader.IsContainer(); -} - -inline bool Atom::seekToContent() const -{ - maRecordHeader.SeekToContent( mrStream ); - return mrStream.GetError() == 0; -} - -inline sal_uInt16 Atom::getType() const -{ - return maRecordHeader.nRecType; -} - -inline sal_uInt16 Atom::getInstance() const -{ - return maRecordHeader.nRecInstance; -} - -inline sal_uInt32 Atom::getLength() const -{ - return maRecordHeader.nRecLen; -} - -Atom::Atom( const DffRecordHeader& rRecordHeader, SvStream& rStream ) -: maRecordHeader( rRecordHeader ), - mrStream( rStream ), - mpFirstChild( 0 ), - mpNextAtom( 0 ), - meStatus( CMP_NOTYET ), - mpCompareAtom( 0 ) -{ - // check if we need to force this to a container - if( maRecordHeader.nRecVer != DFF_PSFLAG_CONTAINER ) - { - AtomConfig* pAtomConfig = dynamic_cast< AtomConfig* >( gAtomConfigMap[ maRecordHeader.nRecType ].get() ); - if( pAtomConfig && pAtomConfig->isContainer() ) - { - maRecordHeader.nRecVer = DFF_PSFLAG_CONTAINER; - } - } - - if( isContainer() ) - { - if( seekToContent() ) - { - DffRecordHeader aChildHeader; - - Atom* pLastAtom = NULL; - - while( (mrStream.GetError() == 0 ) && ( mrStream.Tell() < maRecordHeader.GetRecEndFilePos() ) ) - { - mrStream >> aChildHeader; - - if( mrStream.GetError() == 0 ) - { - Atom* pAtom = new Atom( aChildHeader, mrStream ); - - if( pLastAtom ) - pLastAtom->mpNextAtom = pAtom; - if( mpFirstChild == NULL ) - mpFirstChild = pAtom; - - pLastAtom = pAtom; - } - } - } - } - - maRecordHeader.SeekToEndOfRecord( mrStream ); -} - -Atom::~Atom() -{ - Atom* pChild = mpFirstChild; - while( pChild ) - { - Atom* pNextChild = pChild->mpNextAtom; - delete pChild; - pChild = pNextChild; - } -} - -/** imports this atom and its child atoms */ -Atom* Atom::import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl ) -{ - Atom* pRootAtom = new Atom( rRootRecordHeader, rStCtrl ); - - if( rStCtrl.GetError() == 0 ) - { - return pRootAtom; - } - else - { - delete pRootAtom; - return NULL; - } -} - -/** imports this atom and its child atoms */ -Atom* Atom::import( UINT16 nRecType, SvStream& rStCtrl ) -{ - rStCtrl.Seek( STREAM_SEEK_TO_END ); - sal_Size nStreamLength = rStCtrl.Tell(); - rStCtrl.Seek( STREAM_SEEK_TO_BEGIN ); - - DffRecordHeader aRootRecordHeader; - aRootRecordHeader.nRecVer = DFF_PSFLAG_CONTAINER; - aRootRecordHeader.nRecInstance = 0; - aRootRecordHeader.nImpVerInst = 0; - aRootRecordHeader.nRecType = nRecType; - aRootRecordHeader.nRecLen = nStreamLength; - aRootRecordHeader.nFilePos = 0; - - return import( aRootRecordHeader, rStCtrl ); -} - -/** returns the next child atom after pLast with nRecType or NULL */ -const Atom* Atom::findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const -{ - Atom* pChild = pLast != NULL ? pLast->mpNextAtom : mpFirstChild; - while( pChild && pChild->maRecordHeader.nRecType != nRecType ) - { - pChild = pChild->mpNextAtom; - } - - return pChild; -} - -/** returns the next child atom after pLast with nRecType and nRecInstance or NULL */ -const Atom* Atom::findNextChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance, const Atom* pLast ) const -{ - const Atom* pChild = pLast != NULL ? pLast->mpNextAtom : mpFirstChild; - while( pChild && (pChild->maRecordHeader.nRecType != nRecType) && (pChild->maRecordHeader.nRecInstance != nRecInstance) ) - { - pChild = findNextChildAtom( pChild ); - } - - return pChild; -} - -Atom* Atom::findFirstEqualAtom( Atom* pCompare, Atom* pContainer, Atom* pSearch, int& nDistance ) -{ - nDistance = 0; - - while( pSearch ) - { - if( *pSearch == *pCompare ) - return pSearch; - - pSearch = const_cast< Atom* >( pContainer->findNextChildAtom( pSearch ) ); - nDistance++; - } - - return 0; -} - -Atom* Atom::skipAtoms( Atom* pContainer, Atom* pAtom, Atom* pSkipTo ) -{ - while( pAtom && (pAtom != pSkipTo) ) - { - pAtom->meStatus = CMP_NOTAVAILABLE; - pAtom = const_cast< Atom* >( pContainer->findNextChildAtom( pAtom ) ); - } - - return pAtom; -} - -void Atom::compare( Atom* pAtom ) -{ - if( pAtom ) - { - if( meStatus == CMP_NOTYET ) - { - mpCompareAtom = pAtom; - pAtom->mpCompareAtom = this; - - mpCompareAtom = pAtom; - pAtom->mpCompareAtom = this; - - meStatus = pAtom->meStatus = ( *this == *pAtom ) ? CMP_EQUAL : CMP_NOTEQUAL; - } - - if(meStatus == CMP_EQUAL) - { - if( isContainer() ) - { - /** returns the first child atom or NULL */ - Atom* pChildAtom1 = const_cast< Atom* >( findFirstChildAtom() ); - - if( pChildAtom1 && (pChildAtom1->meStatus == CMP_NOTYET) ) - { - Atom* pChildAtom2 = const_cast< Atom* >( pAtom->findFirstChildAtom() ); - while( pChildAtom1 && pChildAtom2 ) - { - if( !(*pChildAtom1 == *pChildAtom2) ) - { - int nDistance1; - int nDistance2; - - Atom* pFind1 = findFirstEqualAtom( pChildAtom1, pAtom, const_cast< Atom* >( pAtom->findNextChildAtom( pChildAtom2 )), nDistance1 ); - Atom* pFind2 = findFirstEqualAtom( pChildAtom2, this, const_cast< Atom* >(findNextChildAtom( pChildAtom1 )), nDistance2 ); - - if( pFind1 && (!pFind2 || (nDistance1 < nDistance2) ) ) - { - pChildAtom2 = skipAtoms( pAtom, pChildAtom2, pFind1 ); - } - else if( pFind2 ) - { - pChildAtom1 = skipAtoms( this, pChildAtom1, pFind2 ); - } - else - { - pChildAtom1 = skipAtoms( this, pChildAtom1, 0 ); - pChildAtom2 = skipAtoms( pAtom, pChildAtom2, 0 ); - } - } - - if( pChildAtom1 && pChildAtom2 ) - { - pChildAtom1->mpCompareAtom = pChildAtom2; - pChildAtom2->mpCompareAtom = pChildAtom1; - - pChildAtom1->meStatus = pChildAtom2->meStatus = - (pChildAtom1->isContainer() || pChildAtom1->compareContent( *pChildAtom2 )) ? - CMP_EQUAL : CMP_NOTEQUAL; - - pChildAtom1 = const_cast< Atom* >( findNextChildAtom( pChildAtom1 ) ); - pChildAtom2 = const_cast< Atom* >( pAtom->findNextChildAtom( pChildAtom2 ) ); - } - } - } - } - else - { - if( !compareContent( *pAtom ) ) - { - meStatus = pAtom->meStatus = CMP_NOTEQUAL; - } - } - } - } -} - - - - - -class AtomBoxString : public SvLBoxString -{ -public: - AtomBoxString( SvTreeListEntry* pEntry, const String& rStr ) - : SvLBoxString( pEntry, 0, rStr ) - { } - - ~AtomBoxString() { } - - virtual void Paint( - const Point& rPos, SvLBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) - { - Color aOldTextColor = rOutDev.GetTextColor(); - - if( pEntry && pEntry->GetUserData() ) - { - Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() ); - rOutDev.SetTextColor( Color( gColors[ pAtom->getCompareStatus() ] ) ); - } - - SvLBoxString::Paint(rPos, rOutDev, pView, pEntry); - - rOutDev.SetTextColor( aOldTextColor ); - } -}; - -class AtomContainerTreeListBox : public SvTreeListBox -{ -public: - explicit AtomContainerTreeListBox( vcl::Window* pParent ); - ~AtomContainerTreeListBox(); - - void SetRootAtom( const Atom* pAtom ); - - - void SetCollapsingHdl(const Link<>& rNewHdl){maCollapsingHdl=rNewHdl;} - const Link<>& GetCollapsingHdl() const { return maCollapsingHdl; } - - void SetExpandingHdl(const Link<>& rNewHdl){maExpandingHdl=rNewHdl;} - const Link<>& GetExpandingHdl() const { return maExpandingHdl; } - - virtual BOOL Expand( SvTreeListEntry* pParent ); - virtual BOOL Collapse( SvTreeListEntry* pParent ); - - SvTreeListEntry* findAtom( Atom* pAtom ); - - virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&); - virtual void SetTabs(); - -private: - void InsertAtom( const Atom* pAtom, SvTreeListEntry* pParent = 0 ); - const Atom* mpRootAtom; - ResMgr* mpResMgr; - Image maImgFolder; - Image maImgAtom; - Image maImgExpanded; - Image maImgCollapsed; - bool mbRecursiveGuard; - Link<> maCollapsingHdl; - Link<> maExpandingHdl; -}; - -typedef std::pair< AtomContainerTreeListBox*, SvTreeListEntry* > AtomContainerEntryPair; - -AtomContainerTreeListBox::AtomContainerTreeListBox( vcl::Window* pParent ) -: SvTreeListBox( pParent, WB_HASBUTTONS|WB_HASLINES|WB_HASBUTTONSATROOT|WB_3DLOOK|WB_BORDER ), - mpRootAtom( 0 ), mbRecursiveGuard( false ) -{ - mpResMgr = ResMgr::CreateResMgr( "svt" ); - maImgCollapsed = Image( ResId( RID_IMG_TREENODE_COLLAPSED, mpResMgr ) ); - maImgExpanded = Image( ResId( RID_IMG_TREENODE_EXPANDED, mpResMgr ) ); - -// SetDefaultExpandedEntryBmp( aExpanded ); -// SetDefaultCollapsedEntryBmp(aCollapsed ); - - maImgFolder = Image( ResId( IMG_SVT_FOLDER, mpResMgr ) ); - maImgAtom = Image( ResId( IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL, mpResMgr ) ); -} - -AtomContainerTreeListBox::~AtomContainerTreeListBox() -{ -} - -void AtomContainerTreeListBox::SetTabs() -{ - if( IsEditingActive() ) - EndEditing( TRUE ); - - ClearTabList(); - - short nIndent = 0; GetIndent(); - long nNodeWidthPixel = maImgCollapsed.GetSizePixel().Width(); - long nContextWidthDIV2 = nNodeWidthPixel >> 1; - - long nStartPos = 2 + ( nIndent + nContextWidthDIV2 ); - AddTab( nStartPos, SvLBoxTabFlags::DYNAMIC | SvLBoxTabFlags::ADJUST_CENTER ); - nStartPos += nNodeWidthPixel + 5; - AddTab( nStartPos, SvLBoxTabFlags::DYNAMIC | SvLBoxTabFlags::ADJUST_CENTER | SvLBoxTabFlags::SHOW_SELECTION ); - nStartPos += nContextWidthDIV2 + 5; - AddTab( nStartPos, SvLBoxTabFlags::DYNAMIC|SvLBoxTabFlags::ADJUST_LEFT | SvLBoxTabFlags::SHOW_SELECTION ); -} - -void AtomContainerTreeListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& aStr, - const Image& aCollEntryBmp, const Image& aExpEntryBmp) -{ - pEntry->AddItem( new SvLBoxContextBmp(pEntry,0, aCollEntryBmp,aExpEntryBmp, true) ); - pEntry->AddItem( new SvLBoxContextBmp(pEntry,0, maImgAtom, maImgAtom, true) ); - pEntry->AddItem( new AtomBoxString( pEntry, aStr ) ); -} - -SvTreeListEntry* AtomContainerTreeListBox::findAtom( Atom* pAtom ) -{ - SvTreeListEntry* pEntry = First(); - while( pEntry ) - { - if( pEntry->GetUserData() == pAtom ) - return pEntry; - - pEntry = Next( pEntry ); - } - - return 0; -} - -BOOL AtomContainerTreeListBox::Expand( SvTreeListEntry* pParent ) -{ - BOOL bRet = FALSE; - if( !mbRecursiveGuard ) - { - mbRecursiveGuard = true; - AtomContainerEntryPair aPair( this, pParent ); - maExpandingHdl.Call( &aPair); - - bRet = SvTreeListBox::Expand( pParent ); - mbRecursiveGuard = false; - } - return bRet; -} - -BOOL AtomContainerTreeListBox::Collapse( SvTreeListEntry* pParent ) -{ - BOOL bRet = FALSE; - if( !mbRecursiveGuard ) - { - mbRecursiveGuard = true; - AtomContainerEntryPair aPair( this, pParent ); - maCollapsingHdl.Call( &aPair); - - bRet = SvTreeListBox::Collapse( pParent ); - mbRecursiveGuard = false; - } - return bRet; -} - -void AtomContainerTreeListBox::SetRootAtom( const Atom* pAtom ) -{ - mpRootAtom = pAtom; - InsertAtom( mpRootAtom ); -} - -void AtomContainerTreeListBox::InsertAtom( const Atom* pAtom, SvTreeListEntry* pParent /* = 0 */ ) -{ - if( pAtom ) - { - const DffRecordHeader& rHeader = pAtom->getHeader(); - - char buffer[1024]; - - OUString aText; - AtomConfig* pAtomConfig = dynamic_cast< AtomConfig*>( gAtomConfigMap[rHeader.nRecType].get() ); - - if( pAtomConfig ) - aText = pAtomConfig->getName(); - - if( !aText.getLength() ) - { - sprintf( buffer, "unknown_0x%04x", rHeader.nRecType ); - aText += OUString::createFromAscii( buffer ); - } - - sprintf( buffer, " (I: %lu L: %lu)", (UINT32)rHeader.nRecVer, (UINT32)rHeader.nRecLen ); - aText += String( OUString::createFromAscii( buffer ) ); - - SvTreeListEntry* pEntry = 0; - if( pAtom->isContainer() && pAtom->findFirstChildAtom() ) - { - pEntry = InsertEntry( aText, maImgExpanded, maImgCollapsed, pParent ); - - /** returns the first child atom or NULL */ - const Atom* pChildAtom = pAtom->findFirstChildAtom(); - - while( pChildAtom ) - { - InsertAtom( pChildAtom, pEntry ); - pChildAtom = pAtom->findNextChildAtom( pChildAtom ); - } - } - else - { - pEntry = InsertEntry( aText, pParent ); - } - - if( pEntry ) - { - pEntry->SetUserData( (void*)pAtom ); - - if( pAtom->isContainer() ) - { - SvLBoxContextBmp* pBoxBmp = dynamic_cast< SvLBoxContextBmp* >( pEntry->GetItem( pEntry->ItemCount() - 2 ) ); - if( pBoxBmp ) - { - pBoxBmp->SetBitmap1( pEntry, maImgFolder ); - pBoxBmp->SetBitmap2( pEntry, maImgFolder ); - } - } - -/* - pEntry->ReplaceItem( - new AtomBoxString( pEntry, aText, pImage ), - pEntry->ItemCount() - 1 ); -*/ - } - } -} - -extern void load_config( const OUString& rPath ); - -class PPTDocument -{ -public: - explicit PPTDocument( const OUString& rFilePath ); - ~PPTDocument(); - - Atom* getRootAtom() const; - -private: - void Load( const OUString& rFilePath ); - - Atom* mpAtom; - SvStream* mpDocStream; - tools::SvRef<SotStorage> maStorage; -}; - -typedef boost::shared_ptr< PPTDocument > PPTDocumentPtr; - -PPTDocument::PPTDocument(const OUString& rFilePath) -: mpAtom(0), mpDocStream(0) -{ - Load( rFilePath ); -} - -PPTDocument::~PPTDocument() -{ - delete mpAtom; - delete mpDocStream; -} - -void PPTDocument::Load( const OUString& rFilePath ) -{ - maStorage = new SotStorage( rFilePath, STREAM_STD_READ ); - if( !maStorage->GetError() ) - { - mpDocStream = maStorage->OpenSotStream( String( "PowerPoint Document" ), STREAM_STD_READ ); - if( mpDocStream ) - { - DffRecordHeader aRecordHeader; - *mpDocStream >> aRecordHeader; - - mpAtom = Atom::import( 65530, *mpDocStream ); - } - } -} - -Atom* PPTDocument::getRootAtom() const -{ - return mpAtom; -} - - - -class MSViewerWorkWindow : public WorkWindow -{ -public: - MSViewerWorkWindow(); - ~MSViewerWorkWindow(); - - PPTDocumentPtr Load(); - void onView(); - void onCompare(); - void onClose(); - - void View( const PPTDocumentPtr& pDocument, int nPane ); - void Compare( const PPTDocumentPtr& pDocument1, const PPTDocumentPtr& pDocument2 ); - - virtual void Resize(); - -private: - void Sync( AtomContainerEntryPair* pPair, int nAction ); - - AtomContainerTreeListBox* mpListBox[2]; - MultiLineEdit* mpEdit[2]; - PPTDocumentPtr mpDocument[2]; - MenuBar* mpMenuBar; - PopupMenu* mpFileMenu; - bool mbSelectHdlGuard; - DECL_LINK( implSelectHdl, AtomContainerTreeListBox* ); - DECL_LINK( implExpandingHdl, AtomContainerEntryPair* ); - DECL_LINK( implCollapsingHdl, AtomContainerEntryPair* ); - DECL_LINK( implMenuHdl, Menu* ); -}; - - - -void MSViewerWorkWindow::onView() -{ - PPTDocumentPtr pDocument( Load() ); - if( pDocument.get() ) - { - onClose(); - View( pDocument, 0 ); - } -} - -void MSViewerWorkWindow::onClose() -{ -} - -void MSViewerWorkWindow::onCompare() -{ - PPTDocumentPtr pDocument1( Load() ); - if( pDocument1.get() ) - { - PPTDocumentPtr pDocument2( Load() ); - if( pDocument2.get() ) - { - onClose(); - Compare( pDocument1, pDocument2 ); - } - } -} - -void MSViewerWorkWindow::Compare( const PPTDocumentPtr& pDocument1, const PPTDocumentPtr& pDocument2 ) -{ - if( pDocument1.get() && pDocument2.get() ) - { - Atom* pAtom1 = pDocument1->getRootAtom(); - Atom* pAtom2 = pDocument2->getRootAtom(); - pAtom1->setCompareAtom( pAtom2 ); - pAtom2->setCompareAtom( pAtom1 ); - } - - View( pDocument1, 0 ); - View( pDocument2, 1 ); -} - -void MSViewerWorkWindow::View( const PPTDocumentPtr& pDocument, int nPane ) -{ - if( ((nPane != 0) && (nPane != 1)) || (pDocument.get() == 0) ) - return; - - mpDocument[nPane] = pDocument; - - mpListBox[nPane]->SetRootAtom( pDocument->getRootAtom() ); - mpListBox[nPane]->Expand( mpListBox[nPane]->GetEntry(0) ); - mpListBox[nPane]->Show(); - mpEdit[nPane]->Show(); - Resize(); -} - - -PPTDocumentPtr MSViewerWorkWindow::Load() -{ - ::sfx2::FileDialogHelper aDlg( - ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); - String aStrFilterType( "*.ppt" ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); -// INetURLObject aFile( SvtPathOptions().GetPalettePath() ); -// aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - PPTDocumentPtr pDocument; - if ( aDlg.Execute() == ERRCODE_NONE ) - { - pDocument.reset( new PPTDocument( aDlg.GetPath() ) ); - } - - return pDocument; -} - - - -MSViewerWorkWindow::MSViewerWorkWindow() : - WorkWindow( 0, WB_APP | WB_STDWORK | WB_3DLOOK ),mbSelectHdlGuard(false) -{ - Size aOutputSize( 400, 600 ); - SetOutputSizePixel( aOutputSize ); - SetText( String( "MSViewer" ) ); - - Size aOutSize( GetOutputSizePixel() ); - - Font aFont( String( "Courier" ), GetFont().GetSize() ); - - mpMenuBar = new MenuBar(); - mpMenuBar->InsertItem( 1, String( "~File" ) ); - mpFileMenu = new PopupMenu(); - mpFileMenu->InsertItem( 2, String( "~View" ) ); - mpFileMenu->InsertItem( 3, String( "~Compare" ) ); - mpFileMenu->InsertSeparator(); - mpFileMenu->InsertItem( 4, String( "~Quit" ) ); - mpFileMenu->SetSelectHdl( LINK( this, MSViewerWorkWindow, implMenuHdl ) ); - - mpMenuBar->SetPopupMenu( 1, mpFileMenu ); - SetMenuBar( mpMenuBar ); - int nPane; - for( nPane = 0; nPane < 2; nPane++ ) - { - mpListBox[nPane] = new AtomContainerTreeListBox( this ); - mpListBox[nPane]->SetSelectHdl( LINK( this, MSViewerWorkWindow, implSelectHdl ) ); - mpListBox[nPane]->SetExpandingHdl( LINK( this, MSViewerWorkWindow, implExpandingHdl ) ); - mpListBox[nPane]->SetCollapsingHdl( LINK( this, MSViewerWorkWindow, implCollapsingHdl ) ); - - mpEdit[nPane] = VclPtr<MultiLineEdit>::Create(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL ); - mpEdit[nPane]->SetReadOnly( TRUE ); - mpEdit[nPane]->SetReadOnly( TRUE ); - mpEdit[nPane]->SetControlFont( aFont ); - } -} - - - -static String GetAtomText( const Atom* pAtom ) -{ - String aText; - if( pAtom ) - { - const DffRecordHeader& rHeader = pAtom->getHeader(); - char buffer[512]; - sprintf( buffer, "Version = %lu\n\rInstance = %lu\n\rVersionInstance = %lu\n\rLength = %lu\n\r", - (UINT32)rHeader.nRecVer, - (UINT32)rHeader.nRecInstance, - (UINT32)rHeader.nImpVerInst, - (UINT32)rHeader.nRecLen ); - aText = OUString::createFromAscii( buffer ); - if( pAtom->isContainer() ) - { - - } - else - { - pAtom->seekToContent(); - AtomConfig* pAtomConfig = dynamic_cast< AtomConfig* >( gAtomConfigMap[pAtom->getType()].get() ); - if( pAtomConfig ) - { - sal_Size nLength = pAtom->getLength(); - aText += String( pAtomConfig->format( pAtom->getStream(), nLength ) ); - } - else - { - sal_Size nLength = pAtom->getLength(); - aText += String( ElementConfig::dump_hex( pAtom->getStream(), nLength ) ); - } - } - } - - return aText; -} - -IMPL_LINK(MSViewerWorkWindow,implSelectHdl, AtomContainerTreeListBox*, pListBox ) -{ - int nPane = (pListBox == mpListBox[1]) ? 1 : 0; - SvTreeListEntry* pEntry = mpListBox[nPane]->FirstSelected(); - if( pEntry && pEntry->GetUserData() ) - { - Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() ); - mpEdit[nPane]->SetText( GetAtomText( pAtom ) ); - - if(!mbSelectHdlGuard) - { - mbSelectHdlGuard = true; - // select other - AtomContainerEntryPair aPair( pListBox, pEntry ); - Sync( &aPair, 2 ); - mbSelectHdlGuard = false; - } - } - return 0; -} - -void MSViewerWorkWindow::Sync( AtomContainerEntryPair* pPair, int nAction ) -{ - if( mpDocument[0].get() && mpDocument[1].get() && pPair->first && pPair->second ) - { - AtomContainerTreeListBox* pDestinationListBox = (pPair->first == mpListBox[0]) ? mpListBox[1] : mpListBox[0]; - - Atom* pAtom = static_cast<Atom*>(pPair->second->GetUserData()); - if( pAtom && pAtom->getCompareAtom() ) - { - SvTreeListEntry* pEntry = pDestinationListBox->findAtom( pAtom->getCompareAtom() ); - - if(pEntry ) - { - if( nAction == 0 ) - { - pDestinationListBox->Expand( pEntry ); - } - else if( nAction == 1 ) - { - pDestinationListBox->Collapse( pEntry ); - } - else - { - pDestinationListBox->Select( pEntry ); - } - } - } - } -} - -IMPL_LINK(MSViewerWorkWindow, implExpandingHdl, AtomContainerEntryPair*, pPair ) -{ - SvTreeListEntry* pEntry = pPair->second; - if( pEntry && pEntry->GetUserData() ) - { - Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() ); - pAtom->compare( pAtom->getCompareAtom() ); - } - - Sync( pPair, 0 ); - - return 0; -} - -IMPL_LINK(MSViewerWorkWindow, implCollapsingHdl, AtomContainerEntryPair*, pPair ) -{ - Sync( pPair, 1 ); - - return 0; -} - -IMPL_LINK( MSViewerWorkWindow, implMenuHdl, Menu*, pMenu ) -{ - if( pMenu ) - { - USHORT nId = pMenu->GetCurItemId(); - switch( nId ) - { - case 2: onView(); break; - case 3: onCompare(); break; - case 4: Application::Quit(); break; - } - } - return 0; -} - - - -MSViewerWorkWindow::~MSViewerWorkWindow() -{ - int nPane; - for( nPane = 0; nPane < 2; nPane++ ) - { - delete mpListBox[nPane]; - delete mpEdit[nPane]; - } - - delete mpFileMenu; - delete mpMenuBar; -} - - - -void MSViewerWorkWindow::Resize() -{ - int nPaneCount = ((mpDocument[0].get() != 0) ? 1 : 0) + ((mpDocument[1].get() != 0) ? 1 : 0); - - Size aOutputSize( GetOutputSizePixel() ); - int nHeight = aOutputSize.Height() >> 1; - if( nPaneCount ) - { - int nWidth = aOutputSize.Width(); - if( nPaneCount == 2 ) - nWidth >>= 1; - - int nPosX = 0; - - int nPane; - for( nPane = 0; nPane < 2; nPane++ ) - { - mpListBox[nPane]->SetPosSizePixel( nPosX,0, nWidth, nHeight ); - mpEdit[nPane]->SetPosSizePixel( nPosX, nHeight, nWidth, aOutputSize.Height() - nHeight ); - nPosX += nWidth; - } - } -} - - - - - - SAL_IMPLEMENT_MAIN() -{ - if( argc > 3 ) - return 0; - - uno::Reference< lang::XMultiServiceFactory > xMSF; - try - { - uno::Reference< uno::XComponentContext > xCtx( cppu::defaultBootstrap_InitialComponentContext() ); - if ( !xCtx.is() ) - { - OSL_FAIL( "Error creating initial component context!" ); - return -1; - } - - xMSF = uno::Reference< lang::XMultiServiceFactory >(xCtx->getServiceManager(), uno::UNO_QUERY ); - - if ( !xMSF.is() ) - { - OSL_FAIL( "No service manager!" ); - return -1; - } - } - catch ( uno::Exception const & ) - { - OSL_FAIL( "Exception during creation of initial component context!" ); - return -1; - } - comphelper::setProcessServiceFactory( xMSF ); - - InitVCL(); - - String aConfigURL; - if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aConfigURL ) ) - { - INetURLObject aURL( aConfigURL ); - - aURL.removeSegment(); - aURL.removeFinalSlash(); - aURL.Append( String( "msview.xml" ) ); - - load_config( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - } - - { - MSViewerWorkWindow aMainWindow; - - if( argc >= 2 ) - { - const OUString aFile1( OUString::createFromAscii(argv[1]) ); - PPTDocumentPtr pDocument1( new PPTDocument( aFile1 ) ); - - if( argc == 3 ) - { - const OUString aFile2( OUString::createFromAscii(argv[2]) ); - - PPTDocumentPtr pDocument2; - pDocument2.reset( new PPTDocument( aFile2 ) ); - aMainWindow.Compare( pDocument1, pDocument2 ); - } - else - { - aMainWindow.View( pDocument1, 0 ); - } - } - - aMainWindow.Show(); - - Application::Execute(); - } - - DeInitVCL(); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/workben/msview/msview.xml b/svx/workben/msview/msview.xml deleted file mode 100644 index d24b089..0000000 --- a/svx/workben/msview/msview.xml +++ /dev/null @@ -1,311 +0,0 @@ -<?xml version='1.0'?> -<!-- - * 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 . ---> -<config> -<atom name="Unknown" id="0"/> -<atom name="SubatomCompleted" id="1"/> -<atom name="IRRAtom" id="2"/> -<atom name="PSS" id="3"/> -<atom name="SubatomException" id="4"/> -<atom name="ClientSignal1" id="6"/> -<atom name="ClientSignal2" id="7"/> -<atom name="PowerPointStateInfoAtom" id="10"/> -<atom name="Document" id="1000"/> -<atom name="DocumentAtom" id="1001"/> -<atom name="EndDocument" id="1002"/> -<atom name="SlidePersist" id="1003"/> -<atom name="SlideBase" id="1004"/> -<atom name="SlideBaseAtom" id="1005"/> -<atom name="Slide" id="1006"/> -<atom name="SlideAtom" id="1007"/> -<atom name="Notes" id="1008"/> -<atom name="NotesAtom" id="1009"/> -<atom name="Environment" id="1010"/> -<atom name="SlidePersistAtom" id="1011"/> -<atom name="Scheme" id="1012"/> -<atom name="SchemeAtom" id="1013"/> -<atom name="DocViewInfo" id="1014"/> -<atom name="SslideLayoutAtom" id="1015"/> -<atom name="MainMaster" id="1016"/> -<atom name="SSSlideInfoAtom" id="1017"/> -<atom name="SlideViewInfo" id="1018"/> -<atom name="GuideAtom" id="1019"/> -<atom name="ViewInfo" id="1020"/> -<atom name="ViewInfoAtom" id="1021"/> -<atom name="SlideViewInfoAtom" id="1022"/> -<atom name="VBAInfo" id="1023"/> -<atom name="VBAInfoAtom" id="1024"/> -<atom name="SSDocInfoAtom" id="1025"/> -<atom name="Summary" id="1026"/> -<atom name="Texture" id="1027"/> -<atom name="VBASlideInfo" id="1028"/> -<atom name="VBASlideInfoAtom" id="1029"/> -<atom name="DocRoutingSlip" id="1030"/> -<atom name="OutlineViewInfo" id="1031"/> -<atom name="SorterViewInfo" id="1032"/> -<atom name="ExObjList" id="1033"/> -<atom name="ExObjListAtom" id="1034"/> -<atom name="PPDrawingGroup" id="1035"/> -<atom name="PPDrawing" id="1036"/> -<atom name="GridSpacing10Atom" id="1037"/> -<atom name="NamedShows" id="1040"/> -<atom name="NamedShow" id="1041"/> -<atom name="NamedShowSlides" id="1042"/> -<atom name="List" id="2000"/> -<atom name="FontCollection" id="2005"/> -<atom name="ListPlaceholder" id="2017"/> -<atom name="BookmarkCollection" id="2019"/> -<atom name="SoundCollection" id="2020"/> -<atom name="SoundCollAtom" id="2021"/> -<atom name="Sound" id="2022"/> -<atom name="SoundData" id="2023"/> -<atom name="BookmarkSeedAtom" id="2025"/> -<atom name="GuideList" id="2026"/> -<atom name="RunArray" id="2028"/> -<atom name="RunArrayAtom" id="2029"/> -<atom name="ArrayElementAtom" id="2030"/> -<atom name="Int4ArrayAtom" id="2031"/> -<atom name="ColorSchemeAtom" id="2032"/> -<!--<atom name="ExtendedBuGraatom" id="4041"/>--> -<atom name="ExtendedBuGraAtom" id="2041"/> -<atom name="OEShape" id="3008"/> -<atom name="ExObjRefAtom" id="3009"/> -<atom name="OEPlaceholderAtom" id="3011"/> -<atom name="GrColor" id="3020"/> -<atom name="GrectAtom" id="3025"/> -<atom name="GratioAtom" id="3031"/> -<atom name="Gscaling" id="3032"/> -<atom name="GpointAtom" id="3034"/> -<atom name="OEShapeAtom" id="3035"/> -<atom name="OutlineTextRefAtom" id="3998"/> -<atom name="TextHeaderAtom" id="3999"/> -<atom name="TextCharsAtom" id="4000"/> -<atom name="StyleTextPropAtom" id="4001"/> -<atom name="BaseTextPropAtom" id="4002"/> -<atom name="TxMasterStyleAtom" id="4003"/> -<atom name="TxCFStyleAtom" id="4004"/> -<atom name="TxPFStyleAtom" id="4005"/> -<atom name="TextRulerAtom" id="4006"/> -<atom name="TextBookmarkAtom" id="4007"/> -<atom name="TextBytesAtom" id="4008"/> -<atom name="TxSIStyleAtom" id="4009"/> -<atom name="TextSpecInfoAtom" id="4010"/> -<atom name="DefaultRulerAtom" id="4011"/> -<atom name="ExtendedParagraphAtom" id="4012"/> -<atom name="ExtendedParagraphMasterAtom" id="4013"/> -<atom name="ExtendedPresRuleatom" id="4014"/> -<atom name="ExtendedParagraphHeaderAtom" id="4015"/> -<atom name="TextDefaults9Atom" id="4016"/> -<atom name="FontEntityAtom" id="4023"/> -<atom name="FontEmbedData" id="4024"/> -<atom name="TypeFace" id="4025"/> -<atom name="CString" id="4026"> - <element name="unistring" type="unistring"/> -</atom> -<atom name="ExternalObject" id="4027"/> -<atom name="MetaFile" id="4033"/> -<atom name="ExOleObj" id="4034"/> -<atom name="ExOleObjAtom" id="4035"/> -<atom name="ExPlainLinkAtom" id="4036"/> -<atom name="CorePict" id="4037"/> -<atom name="CorePictAtom" id="4038"/> -<atom name="ExPlainAtom" id="4039"/> -<atom name="SrKinsoku" id="4040"/> -<atom name="Handout" id="4041"/> -<atom name="ExEmbed" id="4044"/> -<atom name="ExEmbedAtom" id="4045"/> -<atom name="ExLink" id="4046"/> -<atom name="ExLinkAtom_old" id="4047"/> -<atom name="BookmarkEntityAtom" id="4048"/> -<atom name="ExLinkAtom" id="4049"/> -<atom name="SrKinsokuAtom" id="4050"/> -<atom name="ExHyperlinkAtom" id="4051"/> -<atom name="ExPlain" id="4053"/> -<atom name="ExPlainLink" id="4054"/> -<atom name="ExHyperlink" id="4055"/> -<atom name="SlideNumberMCAtom" id="4056"/> -<atom name="HeadersFooters" id="4057"/> -<atom name="HeadersFootersAtom" id="4058"/> -<atom name="RecolorEntryAtom" id="4062"/> -<atom name="TxInteractiveInfoAtom" id="4063"/> -<atom name="EmFormatAtom" id="4065"/> -<atom name="CharFormatAtom" id="4066"/> -<atom name="ParaFormatAtom" id="4067"/> -<atom name="MasterText" id="4068"/> -<atom name="RecolorInfoAtom" id="4071"/> -<atom name="ExQuickTime" id="4073"/> -<atom name="ExQuickTimeMovie" id="4074"/> -<atom name="ExQuickTimeMovieData" id="4075"/> -<atom name="ExSubscription" id="4076"/> -<atom name="ExSubscriptionSection" id="4077"/> -<atom name="ExControl" id="4078"/> -<atom name="ExControlAtom" id="4091"/> -<atom name="SlideListWithText" id="4080"/> -<atom name="AnimationInfoAtom" id="4081"/> -<atom name="InteractiveInfo" id="4082"/> -<atom name="InteractiveInfoAtom" id="4083"/> -<atom name="SlideList" id="4084"/> -<atom name="UserEditAtom" id="4085"/> -<atom name="CurrentUserAtom" id="4086"/> -<atom name="DateTimeMCAtom" id="4087"/> -<atom name="GenericDateMCAtom" id="4088"/> -<atom name="HeaderMCAtom" id="4089"/> -<atom name="FooterMCAtom" id="4090"/> -<atom name="ExMediaAtom" id="4100"/> -<atom name="ExVideo" id="4101"/> -<atom name="ExAviMovie" id="4102"/> -<atom name="ExMCIMovie" id="4103"/> -<atom name="ExMIDIAudio" id="4109"/> -<atom name="ExCDAudio" id="4110"/> -<atom name="ExWAVAudioEmbedded" id="4111"/> -<atom name="ExWAVAudioLink" id="4112"/> -<atom name="ExOleObjStg" id="4113"/> -<atom name="ExCDAudioAtom" id="4114"/> -<atom name="ExWAVAudioEmbeddedAtom" id="4115"/> -<atom name="AnimationInfo" id="4116"/> -<atom name="RTFDateTimeMCAtom" id="4117"/> -<atom name="ProgTags" id="5000"/> -<atom name="ProgStringTag" id="5001"/> -<atom name="ProgBinaryTag" id="5002"/> -<container name="BinaryTagData" id="5003"/> -<atom name="PrintOptions" id="6000"/> -<atom name="PersistPtrFullBlock" id="6001"/> -<atom name="PersistPtrIncrementalBlock" id="6002"/> -<atom name="PresentationAdvisorFlags9Atom" id="6010"/> -<atom name="HtmlDocInfo9Atom" id="6011"/> - -<!-- animations--> -<atom name="AnimEvent" id="0xf125"/> -<atom name="AnimNode" id="0xf127"> -<element name="U1" type="uint"/> -<element name="Restart" type="uint"> - <value name="always" value="1"/> - <value name="whenOff" value="2"/> - <value name="never" value="3"/> -</element> -<element name="GroupType" type="uint"/> -<element name="Fill" type="uint"> - <value name="remove" value="1"/> - <value name="freeze" value="2"/> - <value name="hold" value="3"/> -</element> -<element name="U3" type="uint"/> -<element name="U4" type="uint"/> -<element name="Duration" type="uint"/> -<element name="NodeType" type="uint"/> -</atom> -<atom name="AnimTrigger" id="0xf128"> - <element name="U1" type="uint"/> - <element name="Trigger" type="uint"> - <value name="NONE" value="0"/> - <value name="ON_BEGIN" value="1"/> - <value name="ON_END" value="2"/> - <value name="BEGIN_EVENT" value="3"/> - <value name="END_EVENT" value="4"/> - <value name="ON_CLICK" value="5"/> - <value name="ON_DBL_CLICK" value="6"/> - <value name="ON_MOUSE_ENTER" value="7"/> - <value name="ON_MOUSE_LEAVE" value="8"/> - <value name="ON_NEXT" value="9"/> - <value name="ON_PREV" value="10"/> - <value name="ON_STOP_AUDIO" value="11"/> - </element> - <element name="U3" type="uint"/> - <element name="Begin" type="uint"/> -</atom> -<atom name="AnimValue" id="0xf129"> - <switch type="uint"> - <case value="0"> - <element name="repeat" type="float"/> - </case> - <case value="3"> - <element name="accelerate" type="float"/> - </case> - <case value="4"> - <element name="decelerate" type="float"/> - </case> - <case value="5"> - <element name="autoreverse" type="uint"/> - </case> - </switch> -</atom> -<atom name="AnimateTarget" id="0xf12a"/> -<atom name="Animate" id="0xf12b"/> -<atom name="AnimateColor" id="0xf12c"/> -<atom name="AnimateFilter" id="0xf12d"/> -<atom name="AnimateMotion" id="0xf12e"/> -<atom name="AnimateRotation" id="0xf12f"/> -<atom name="AnimateScale" id="0xf130"/> -<atom name="AnimateSet" id="0xf131"/> -<atom name="AnimCommand" id="0xf132"/> -<atom name="AnimateTargetSettings" id="0xf133"/> -<atom name="AnimateData" id="0xf134"/> -<atom name="AnimateColorData" id="0xf135"/> -<atom name="AnimateFilterData" id="0xf136"/> -<atom name="AnimateMotionData" id="0xf137"/> -<atom name="AnimateScaleData" id="0xf139"/> -<atom name="AnimateSetData" id="0xf13a"/> -<atom name="CommandData" id="0xf13b"/> -<atom name="AnimateTargetElement" id="0xf13c"/> -<atom name="AnimPropertySet" id="0xf13d"/> -<atom name="AnimateAttributeNames" id="0xf13e"/> -<atom name="AnimKeyPoints" id="0xf13f"/> -<atom name="AnimIteration" id="0xf140"/> -<atom name="AnimAction" id="0xf141"/> -<atom name="AnimAttributeValue" id="0xf142"> - <switch type="byte"> - <case value="0"> - <element name="byte" type="byte"/> - </case> - <case value="1"> - <element name="uint" type="uint"/> - </case> - <case value="2"> - <element name="float" type="float"/> - </case> - <case value="3"> - <element name="unistring" type="unistring"/> - </case> - </switch> -</atom> -<atom name="AnimKeyTime" id="0xf143"/> -<atom name="AnimGroup" id="0xf144"/> -<atom name="AnimSubGoup" id="0xf145"/> -<atom name="AnimateRotationData" id="0xf138"/> -<atom name="AnimReference" id="0x2afb"> - <element name="RefMode" type="uint"> - <value name="as-whole" value="0"/> - <value name="only-background" value="6"/> - <value name="only-text" value="8"/> - <value name="text-portion" value="2"/> - </element> - <element name="RefType" type="uint"> - <value name="shape" value="1"/> - <value name="sound" value="2"/> - <value name="audio" value="3"/> - <value name="video" value="4"/> - </element> - <element name="RefId" type="uint"/> - <element name="Begin" type="uint"/> - <element name="End" type="uint"/> -</atom> - -<!-- internal--> -<atom name="PowerPoint Document" id="65530"/> - -</config> diff --git a/svx/workben/msview/xmlconfig.cxx b/svx/workben/msview/xmlconfig.cxx deleted file mode 100644 index a3324a3..0000000 --- a/svx/workben/msview/xmlconfig.cxx +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - - -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/xml/sax/InputSource.hpp> -#include <com/sun/star/xml/sax/Parser.hpp> -#include <com/sun/star/xml/sax/SAXParseException.hpp> -#include <com/sun/star/io/IOException.hpp> -#include <cppuhelper/implbase1.hxx> -#include <comphelper/processfactory.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <unotools/streamwrap.hxx> -#include "comphelper/anytostring.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "rtl/ref.hxx" - -#include <svx/msdffimp.hxx> - -#include "xmlconfig.hxx" - -#include <stdio.h> -#include <ctype.h> -#include <stack> - -using ::com::sun::star::io::XInputStream; -using ::com::sun::star::io::IOException; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::xml::sax; - - - -AtomConfigMap gAtomConfigMap; - - - -class ConfigHandler : public ::cppu::WeakAggImplHelper1<XDocumentHandler> -{ -public: - // XDocumentHandler - virtual void SAL_CALL startDocument() throw( SAXException, RuntimeException ); - virtual void SAL_CALL endDocument() throw( SAXException, RuntimeException ); - virtual void SAL_CALL startElement(const OUString& aName, const Reference< XAttributeList > & xAttribs) throw( SAXException, RuntimeException ); - virtual void SAL_CALL endElement(const OUString& aName) throw( SAXException, RuntimeException ); - virtual void SAL_CALL characters(const OUString& aChars) throw( SAXException, RuntimeException ); - virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) throw( SAXException, RuntimeException ); - virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) throw( SAXException, RuntimeException ); - virtual void SAL_CALL setDocumentLocator(const Reference< XLocator > & xLocator) throw( SAXException, RuntimeException ); - -private: - void errorThrow( const OUString& rErrorMessage ) throw (SAXException ); - ElementConfigType parseType( const OUString& rErrorMessage ) throw ( SAXException ); - void addElement( ElementConfigPtr& rElementConfig ) throw ( SAXException ); - OUString getAttribute( const Reference< XAttributeList > & xAttribs, const sal_Char* pName ) throw( SAXException ); - - ElementConfigPtr importAtomConfig( const Reference< XAttributeList > & xAttribs, bool bIsContainer ) throw( SAXException ); - ElementConfigPtr importElementConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException ); - ElementConfigPtr importSwitchConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException ); - ElementConfigPtr importCaseConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException ); - ElementConfigPtr importValueElementConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException ); - - std::stack< ElementConfigPtr > maElementStack; -}; - -void ConfigHandler::errorThrow( const OUString& rErrorMessage ) throw (SAXException ) -{ - Reference< XInterface > aContext; - Any aWrappedException; - throw SAXException(rErrorMessage, aContext, aWrappedException); -} - -ElementConfigType ConfigHandler::parseType( const OUString& sType ) throw (SAXException ) -{ - if ( sType == "uint" ) - { - return ECT_UINT; - } - else if ( sType == "byte" ) - { - return ECT_BYTE; - } - else if ( sType == "unistring" ) - { - return ECT_UNISTRING; - } - else if ( sType == "float" ) - { - return ETC_FLOAT; - } - else if ( sType == "hexdump" ) - { - } - else - { - OUString aMessage( "unknown type: " ); - aMessage += sType; - errorThrow( aMessage ); - } - - return ECT_HEXDUMP; -} - -void ConfigHandler::addElement( ElementConfigPtr& rElementConfig ) throw ( SAXException ) -{ - ElementConfigContainer* pParent = dynamic_cast< ElementConfigContainer* >( maElementStack.top().get() ); - - if( !pParent ) - errorThrow( OUString( "illegal parent for element" ) ); - - - pParent->addElementConfig( rElementConfig ); -} - -OUString ConfigHandler::getAttribute( const Reference< XAttributeList > & xAttribs, const sal_Char* pName ) throw( SAXException ) -{ - OUString aName( OUString::createFromAscii( pName ) ); - - const sal_Int16 nAttrCount = xAttribs.is() ? xAttribs->getLength() : 0; - sal_Int16 i; - for(i=0; i < nAttrCount; i++) - { - if( xAttribs->getNameByIndex( i ) == aName ) - return xAttribs->getValueByIndex( i ); - } - - OUString aMessage( "missing required attribute: " ); - aMessage += aName; - errorThrow( aMessage ); - - return OUString(); -} - -void SAL_CALL ConfigHandler::startDocument() throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ConfigHandler::endDocument() throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ConfigHandler::startElement(const OUString& aName, const Reference< XAttributeList > & xAttribs) throw( SAXException, RuntimeException ) -{ - ElementConfigPtr pElement; - - if ( aName == "config" ) - { - return; - } - - if ( aName == "container" ) - { - pElement = importAtomConfig( xAttribs, true ); - } - else if ( aName == "atom" ) - { - pElement = importAtomConfig( xAttribs, false ); - } - else if ( aName == "element" ) - { - pElement = importElementConfig( xAttribs ); - } - else if ( aName == "value" ) - { - pElement = importValueElementConfig( xAttribs ); - } - else if ( aName == "switch" ) - { - pElement = importSwitchConfig( xAttribs ); - } - else if ( aName == "case" ) - { - pElement = importCaseConfig( xAttribs ); - } - - if( !pElement.get() ) - { - OUString aMessage( "unknown config element: " ); - aMessage += aName; - errorThrow( aMessage ); - } - - maElementStack.push( pElement ); -} - -sal_Int32 toInt( const OUString& rText ) -{ - if( rText.startsWith("0x")) - { - sal_Int32 nValue = 0; - const sal_Unicode *p = rText; - p += 2; - sal_Int32 nLength = rText.getLength() - 2; - while( (nLength--) > 0 ) - { - nValue <<= 4; - if( *p >= '0' && *p <= '9' ) - { - nValue += *p - '0'; - } - else if( *p >= 'a' && *p <= 'f' ) - { - nValue += *p - ('a' - 10); - } - else if( *p >= 'A' && *p <= 'F' ) - { - nValue += *p - ('A' - 10 ); - } - p++; - } - - return nValue; - } - else - { - return rText.toInt32(); - } -} - -ElementConfigPtr ConfigHandler::importAtomConfig( const Reference< XAttributeList > & xAttribs, bool bIsContainer ) throw (SAXException) -{ - if( !maElementStack.empty() ) - errorThrow( OUString( "atom elements must be root" ) ); - - ElementConfigPtr aPtr( new AtomConfig( getAttribute(xAttribs,"name"), bIsContainer ) ); - gAtomConfigMap[ (UINT16)toInt(getAttribute(xAttribs,"id"))] = aPtr; - return aPtr; -} - -ElementConfigPtr ConfigHandler::importElementConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException) -{ - ElementConfigType nType = parseType( getAttribute( xAttribs, "type" ) ); - ElementConfigPtr pElementConfig( new ElementConfigContainer( getAttribute( xAttribs, "name" ), nType ) ); - addElement( pElementConfig ); - return pElementConfig; -} - -ElementConfigPtr ConfigHandler::importValueElementConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException) -{ - ElementConfigPtr pElementConfig( new ElementValueConfig( getAttribute( xAttribs, "name" ), getAttribute( xAttribs, "value" ) ) ); - addElement( pElementConfig ); - return pElementConfig; -} - -ElementConfigPtr ConfigHandler::importSwitchConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException) -{ - ElementConfigType nType = parseType( getAttribute( xAttribs, "type" ) ); - ElementConfigPtr pElementConfig( new SwitchElementConfig( nType ) ); - addElement( pElementConfig ); - return pElementConfig; -} - -ElementConfigPtr ConfigHandler::importCaseConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException) -{ - ElementConfigPtr pElementConfig( new CaseElementConfig( getAttribute( xAttribs, "value" ) ) ); - addElement( pElementConfig ); - return pElementConfig; -} - -void SAL_CALL ConfigHandler::endElement(const OUString& aName) throw( SAXException, RuntimeException ) -{ - if ( aName == "config" ) - { - return; - } - - maElementStack.pop(); -} - -void SAL_CALL ConfigHandler::characters(const OUString& aChars) throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ConfigHandler::ignorableWhitespace(const OUString& aWhitespaces) throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ConfigHandler::processingInstruction(const OUString& aTarget, const OUString& aData) throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ConfigHandler::setDocumentLocator(const Reference< XLocator > & xLocator) throw( SAXException, RuntimeException ) -{ -} - -void load_config( const OUString& rPath ) -{ - try - { - // create stream - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rPath, StreamMode::READ ); - Reference<XInputStream> xInputStream( new utl::OInputStreamWrapper( pIStm, sal_True ) ); - - // prepare ParserInputSrouce - InputSource aParserInput; - aParserInput.sSystemId = rPath; - aParserInput.aInputStream = xInputStream; - - // get parser - Reference< XParser > xParser = Parser::create(comphelper::getProcessComponentContext()); - - // get filter - ConfigHandler* pConfigHandler = new ConfigHandler(); - Reference< XDocumentHandler > xFilter( pConfigHandler ); - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); - - // finally, parser the stream - xParser->parseStream( aParserInput ); - } - catch( Exception& ) - { - OSL_FAIL( - (OString("load_config(), " - "exception caught: ") + - OUStringToOString( - comphelper::anyToString( cppu::getCaughtException() ), - RTL_TEXTENCODING_UTF8 )).getStr() ); - } -} - - - -OUString ElementConfig::format( SvStream& rStream, sal_Size& nLength ) const -{ - OUString aRet; - if( maName.getLength() ) - { - aRet += maName + " = "; - } - - switch( mnType ) - { - case ECT_BYTE: aRet += dump_byte( rStream, nLength ); break; - case ECT_UINT: aRet += dump_uint( rStream, nLength ); break; - case ECT_UNISTRING: aRet += dump_unistring( rStream, nLength ); break; - case ETC_FLOAT: aRet += dump_float( rStream, nLength ); break; - case ECT_HEXDUMP: - default: aRet += dump_hex( rStream, nLength ); break; - } - - return aRet; -} - -OUString ElementConfig::dump_hex( SvStream& rStream, sal_Size& nLength ) -{ - char buffer[128]; - OUString aOut, aEmpty; - OUString aHex, aAscii; - sal_Char c; - int nRow = 0; - while( nLength && (rStream.GetError() == 0) ) - { - rStream >> c; - nLength--; - - unsigned int i = c; - i &= 0xff; - sprintf( buffer, "%02x ", i ); - aHex += OUString::createFromAscii( buffer ); - - if( !isprint( c ) ) - c = '.'; - - aAscii += OUString( (sal_Unicode) c ); - nRow++; - - if( (nRow == 16) || (nLength==0) ) - { - while( aHex.getLength() < (16*3) ) - aHex += " "; - aOut += aHex; - aOut += aAscii; - aOut += "\n\r"; - aHex = aEmpty; - aAscii = aEmpty; - nRow = 0; - } - } - - aOut += aHex; - aOut += aAscii; - - return aOut; -} - -OUString ElementConfig::dump_byte( SvStream& rStream, sal_Size& nLength ) -{ - OUString aRet; - if( nLength >= sizeof(sal_Char) ) - { - sal_Char c; - rStream >> c; - - char buffer[128]; - sprintf( buffer, "%u", (int)c ); - aRet += OUString::createFromAscii( buffer ); - nLength -= sizeof(sal_Char); - } - - return aRet; -} - -OUString ElementConfig::dump_uint( SvStream& rStream, sal_Size& nLength ) -{ - OUString aRet; - if( nLength >= sizeof( sal_uInt32 ) ) - { - sal_uInt32 c; - rStream >> c; - - char buffer[128]; - sprintf( buffer, "%u", c ); - aRet += OUString::createFromAscii( buffer ); - nLength-= sizeof( sal_uInt32 ); - } - - return aRet; -} - -OUString ElementConfig::dump_unistring( SvStream& rStream, sal_Size& nLength ) -{ - String aString = SvxMSDffManager::MSDFFReadZString( rStream, nLength, sal_True ); - nLength = 0; - return aString; -} - -OUString ElementConfig::dump_float( SvStream& rStream, sal_Size& nLength ) -{ - OUString aRet; - if( nLength >= sizeof( float ) ) - { - float c; - rStream >> c; - - char buffer[128]; - sprintf( buffer, "%g", (double)c ); - aRet += OUString::createFromAscii( buffer ); - nLength-= sizeof( float ); - } - - return aRet; -} - - - -OUString ElementConfigContainer::format( SvStream& rStream, sal_Size& nLength ) const -{ - OUString aRet; - - if( getType() == ETC_CONTAINER ) - { - - ElementConfigList::const_iterator aIter( maElementConfigList.begin() ); - const ElementConfigList::const_iterator aEnd( maElementConfigList.end() ); - while( (aIter != aEnd) && (nLength > 0) ) - { - aRet += (*aIter++)->format( rStream, nLength ); - if( (aIter != aEnd) || (nLength != 0) ) - aRet += "\n\r"; - } - - if( nLength ) - aRet += ElementConfig::dump_hex( rStream, nLength ); - } - else - { - aRet = getName(); - if( aRet.getLength() ) - aRet += " = "; - - OUString aValue; - switch( getType() ) - { - case ECT_BYTE: aValue = dump_byte( rStream, nLength ); break; - case ECT_UINT: aValue = dump_uint( rStream, nLength ); break; - case ECT_UNISTRING: aValue = dump_unistring( rStream, nLength ); break; - case ETC_FLOAT: aValue = dump_float( rStream, nLength ); break; - case ECT_HEXDUMP: - default: aValue = dump_hex( rStream, nLength ); break; - } - - if( aValue.getLength() ) - { - if( !maElementConfigList.empty() ) - { - ElementConfigList::const_iterator aIter( maElementConfigList.begin() ); - const ElementConfigList::const_iterator aEnd( maElementConfigList.end() ); - while( (aIter != aEnd) && (nLength > 0) ) - { - ElementValueConfig* pValue = dynamic_cast< ElementValueConfig* >( (*aIter++).get() ); - if( pValue && pValue->getValue() == aValue ) - { - aValue = pValue->getName(); - break; - } - } - } - } - else - { - aValue = "<empty!?>"; - } - - aRet += aValue; - } - - return aRet; -} - - - -OUString SwitchElementConfig::format( SvStream& rStream, sal_Size& nLength ) const -{ - OUString aValue; - - switch( getType() ) - { - case ECT_BYTE: aValue = dump_byte( rStream, nLength ); break; - case ECT_UINT: aValue = dump_uint( rStream, nLength ); break; - case ETC_FLOAT: aValue = dump_float( rStream, nLength ); break; - case ECT_UNISTRING: aValue = dump_unistring( rStream, nLength ); break; - } - - if( aValue.getLength() ) - { - ElementConfigList::const_iterator aIter( maElementConfigList.begin() ); - const ElementConfigList::const_iterator aEnd( maElementConfigList.end() ); - while( (aIter != aEnd) && (nLength > 0) ) - { - CaseElementConfig* pCase = dynamic_cast< CaseElementConfig* >( (*aIter++).get() ); - if( pCase && pCase->getValue() == aValue ) - return pCase->format( rStream, nLength ); - } - } - - return ElementConfig::dump_hex( rStream, nLength ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/workben/msview/xmlconfig.hxx b/svx/workben/msview/xmlconfig.hxx deleted file mode 100644 index cf563f7..0000000 --- a/svx/workben/msview/xmlconfig.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#ifndef INCLUDED_SVX_WORKBEN_MSVIEW_XMLCONFIG_HXX -#define INCLUDED_SVX_WORKBEN_MSVIEW_XMLCONFIG_HXX - -#include <map> -#include <list> -#include <boost/shared_ptr.hpp> - - - -enum ElementConfigType { ECT_HEXDUMP, ECT_BYTE, ECT_UINT, ECT_UNISTRING, ETC_FLOAT, ETC_CONTAINER }; - -class ElementConfig -{ -public: - ElementConfig() : mnType( ECT_HEXDUMP ) {} - ElementConfig( const OUString& rName, ElementConfigType rType ) : maName( rName ), mnType( rType ) {} - explicit ElementConfig( const OUString& rName ) : maName( rName ) {} - explicit ElementConfig( ElementConfigType rType ) : mnType( rType ) {} - - virtual OUString format( SvStream& rStream, sal_Size& nLength ) const; - - const OUString& getName() const { return maName; } - ElementConfigType getType() const { return mnType; } - - static OUString dump_hex( SvStream& rStream, sal_Size& nLength ); - static OUString dump_byte( SvStream& rStream, sal_Size& nLength ); - static OUString dump_uint( SvStream& rStream, sal_Size& nLength ); - static OUString dump_unistring( SvStream& rStream, sal_Size& nLength ); - static OUString dump_float( SvStream& rStream, sal_Size& nLength ); -private: - OUString maName; - ElementConfigType mnType; -}; -typedef boost::shared_ptr< ElementConfig > ElementConfigPtr; -typedef std::list< ElementConfigPtr > ElementConfigList; - - - -class ElementValueConfig : public ElementConfig -{ -public: - ElementValueConfig( const OUString& rName, const OUString& rValue ) : ElementConfig( rName ), maValue( rValue ) {} - - const OUString& getValue() const { return maValue; } - -private: - OUString maValue; -}; - - - -class ElementConfigContainer : public ElementConfig -{ -public: - ElementConfigContainer() : ElementConfig( ETC_CONTAINER ) {} - ElementConfigContainer( const OUString& rName, ElementConfigType rType ) : ElementConfig( rName, rType ) {} - explicit ElementConfigContainer( const OUString& rName ) : ElementConfig( rName, ETC_CONTAINER ) {} - explicit ElementConfigContainer( ElementConfigType rType ) : ElementConfig( rType ) {} - - virtual OUString format( SvStream& rStream, sal_Size& nLength ) const; - - void addElementConfig( ElementConfigPtr p ) { maElementConfigList.push_back( p ); } - -protected: - ElementConfigList maElementConfigList; -}; - - - -class CaseElementConfig : public ElementConfigContainer -{ -public: - explicit CaseElementConfig( const OUString& rValue ) : maValue( rValue ) {} - - const OUString& getValue() const { return maValue; } - -private: - OUString maValue; -}; - -class SwitchElementConfig : public ElementConfigContainer -{ -public: - explicit SwitchElementConfig( ElementConfigType rType ) : ElementConfigContainer( rType ) {} - - virtual OUString format( SvStream& rStream, sal_Size& nLength ) const; -}; - -class AtomConfig : public ElementConfigContainer -{ -public: - AtomConfig( const OUString& rName, bool bIsContainer ) : ElementConfigContainer( rName ), mbIsContainer( bIsContainer ) {} - - bool isContainer() const { return mbIsContainer; } - -protected: - bool mbIsContainer; -}; - -typedef std::map< UINT16, ElementConfigPtr > AtomConfigMap; - -extern AtomConfigMap gAtomConfigMap; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/workben/pixelctl.cxx b/svx/workben/pixelctl.cxx deleted file mode 100644 index 127b1be..0000000 --- a/svx/workben/pixelctl.cxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#include <sal/main.h> - -#include <cppuhelper/bootstrap.hxx> -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <tools/extendapplicationenvironment.hxx> - -#include <svx/dlgctrl.hxx> - -#include <rtl/strbuf.hxx> -#include <rtl/ustrbuf.hxx> - -#include <math.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace cppu; - -// Forward declaration -void Main(); - -SAL_IMPLEMENT_MAIN() -{ - try - { - tools::extendApplicationEnvironment(); - - // create the global service-manager - Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext(); - Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY ); - - if( !xServiceManager.is() ) - Application::Abort( "Failed to bootstrap" ); - - comphelper::setProcessServiceFactory( xServiceManager ); - - InitVCL(); - ::Main(); - DeInitVCL(); - } - catch (const Exception& e) - { - SAL_WARN("vcl.app", "Fatal exception: " << e.Message); - return 1; - } - catch (const std::exception& e) - { - SAL_WARN("vcl.app", "Fatal exception: " << e.what()); - return 1; - } - - return 0; -} - -class MyWin : public WorkWindow -{ - VclPtr<SvxPixelCtl> maPixelCtl; - -public: - MyWin(vcl::Window* pParent, WinBits nWinStyle); - virtual ~MyWin() - { - disposeOnce(); - } - virtual void dispose() SAL_OVERRIDE; - void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; - void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; - void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; - void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; - void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE; - void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; - void Resize() SAL_OVERRIDE; - bool Close() SAL_OVERRIDE; -}; - -void Main() -{ - ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK ); - aMainWin->SetText( OUString( "SvxPixelCtl" ) ); - aMainWin->Show(); - - Application::Execute(); -} - -MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) : - WorkWindow( pParent, nWinStyle ), - maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) ) -{ - maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) ); - maPixelCtl->Show(); - -} - -void MyWin::dispose() -{ - maPixelCtl.disposeAndClear(); - WorkWindow::dispose(); -} - -bool MyWin::Close() -{ - bool bRet = WorkWindow::Close(); - if( bRet ) - Application::Quit(); - return bRet; -} - -void MyWin::MouseMove( const MouseEvent& rMEvt ) -{ - WorkWindow::MouseMove( rMEvt ); -} - -void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) -{ - WorkWindow::MouseButtonDown( rMEvt ); -} - -void MyWin::MouseButtonUp( const MouseEvent& rMEvt ) -{ - WorkWindow::MouseButtonUp( rMEvt ); -} - -void MyWin::KeyInput( const KeyEvent& rKEvt ) -{ - WorkWindow::KeyInput( rKEvt ); -} - -void MyWin::KeyUp( const KeyEvent& rKEvt ) -{ - WorkWindow::KeyUp( rKEvt ); -} - -void MyWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) -{ - WorkWindow::Paint(rRenderContext, rRect); -} - -void MyWin::Resize() -{ - WorkWindow::Resize(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits