<commit_before>#include "llvm/Instructions.h"

#define OPT_LOCAL_REGISTERS //XXX

#include "libcpu.h"
#include "libcpu_llvm.h"
#include "frontend.h"
#include "fapra_internal.h"

#include <inttypes.h>

using namespace llvm;

//////////////////////////////////////////////////////////////////////
// fapra: instruction decoding
//////////////////////////////////////////////////////////////////////

// Instruction decoding helper functions.
static inline uint32_t opc(uint32_t ins) {
  return ins >> 26;
}

static inline uint32_t rd(uint32_t ins) {
  return (ins >> 21) & 0x1F;
}

static inline uint32_t ra(uint32_t ins) {
  return (ins >> 16) & 0x1F;
}

static inline uint32_t rb(uint32_t ins) {
  return (ins >> 11) & 0x1F;
}

static inline sint32_t simm(uint32_t ins) {
  return ((int32_t) ((ins & 0xFFFF) << 16)) >> 16;
}

static inline uint32_t imm(uint32_t ins) {
  return ins & 0xFFFF;
}

#define RD ((instr >> 21) & 0x1F)
#define RA ((instr >> 16) & 0x1F)
#define RB ((instr >> 11) & 0x1F)
#define GetImmediate (instr & 0xFFFF)

#define INST_SIZE 4

//////////////////////////////////////////////////////////////////////
// tagging
//////////////////////////////////////////////////////////////////////

#include "tag.h"
int arch_fapra_tag_instr(cpu_t *cpu, addr_t pc, tag_t *tag, addr_t *new_pc,
						 addr_t *next_pc) {
	uint32_t ins = INSTR(pc);

	switch (opc(ins)) {
	case RFE:
	case PERM:
	case RDC8:
	case TGE:
	case TSE:
	default:
	  fprintf(stderr, "Illegal instruction!\n");
	  exit(EXIT_FAILURE);
	case LDW:
	case STW:
	case LDB:
	case STB:
	case LDIH:
	case LDIL:
	case ADDI:
	case ADD:
	case SUB:
	case AND:
	case OR:
	case NOT:
	case SARI:
	case SAL:
	case SAR:
	case MUL:
	case NOP:
		*tag = TAG_CONTINUE;
		break;
	case JMP:
		*tag = TAG_RET;
		break;
	case BRA:
		*tag = TAG_BRANCH;
		*new_pc = pc + simm(ins);
		break;
	case BZ:
	case BNZ:
		*tag = TAG_COND_BRANCH;
		*new_pc = pc + simm(ins);
		break;
	case CALL: {
		// Look for sequences like:
		//   ldih $X, 0x...
		//   ldil $X, 0x...
		//   call $Y, $X ($Y is the link register)

		// FIXME Make sure those two memory accesses are not out of bounds.
		uint32_t ldih = INSTR(pc - (INST_SIZE * 2));
		uint32_t ldil = INSTR(pc - INST_SIZE);

		if (opc(ldih) == LDIH && opc(ldil) == LDIL
			&& rd(ldih) == rd(ldil) && rd(ldih) == ra(ins)) {
			*new_pc = (imm(ldih) << 16) | imm(ldil);
		} else {
			*new_pc = NEW_PC_NONE;
		}

		*tag = TAG_CALL;
	}
		break;
	case BL:
		*tag = TAG_CALL;
		*new_pc = pc + simm(ins);
		break;
	}

	*next_pc = pc + INST_SIZE;

	return INST_SIZE;
}

//////////////////////////////////////////////////////////////////////

Value *
arch_fapra_get_imm(cpu_t *cpu, uint32_t instr, uint32_t bits, bool sext,
  BasicBlock *bb) {
	uint64_t imm;
	if (sext)
		imm = (uint64_t)(sint16_t)GetImmediate;
	else
		imm = (uint64_t)(uint16_t)GetImmediate;

	return ConstantInt::get(getIntegerType(bits? bits : cpu->info.word_size), imm);
}

#define IMM arch_fapra_get_imm(cpu, instr, 0, true, bb)
#define IMMU arch_fapra_get_imm(cpu, instr, 0, false, bb)

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

#define LET_PC(v) new StoreInst(v, cpu->ptr_PC, bb)

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

Value *
arch_fapra_translate_cond(cpu_t *cpu, addr_t pc, BasicBlock *bb)
{
	uint32_t instr = INSTR(pc);

	LOG("cond (%08" PRIx64 ") %08x\n", pc, instr);

	switch (opc(instr)) {
	default:
		fprintf(stderr, "Illegal instruction!\n");
		exit(EXIT_FAILURE);
	case BZ:
		// Emit nothing.
		return ICMP_EQ(R(RA), CONST(0));
		break;
	case BNZ:
		return ICMP_NE(R(RA), CONST(0));
		break;
	}
}

int
arch_fapra_translate_instr(cpu_t *cpu, addr_t pc, BasicBlock *bb)
{
#define BAD printf("%s:%d\n", __func__, __LINE__); exit(1);
#define LOGX LOG("%s:%d\n", __func__, __LINE__);

	uint32_t instr = INSTR(pc);

	LOG("translating (%08" PRIx64 ") %08x\n", pc, instr);

	switch (opc(instr)) {
	case PERM:
	case RDC8:
	case TGE:
	case TSE:
	case SARI:
	case RFE:
	default:
		fprintf(stderr, "Illegal instruction!\n");
		exit(EXIT_FAILURE);
	case LDW:
		LOAD32(RD, ADD(R(RA), IMM));
		break;
	case STW:
		STORE32(R(RD), ADD(R(RA), IMM));
		break;
	case LDB:
		LOAD8(RD, ADD(R(RA), IMM));
		break;
	case STB:
		STORE8(R(RD), ADD(R(RA), IMM));
		break;
	case LDIH:
		LET(RD, OR(AND(R(RD), CONST(0xFFFF)), CONST(GetImmediate << 16)));
		break;
	case LDIL:
		LET(RD, OR(AND(R(RD), CONST(0xFFFF0000)), IMMU));
		break;
	case JMP:
		LET_PC(R(RA));
		break;
	case BRA:
//		LET_PC(CONST(pc + simm(instr)));
		break;
	case BZ:
		// Emit nothing.
		break;
	case BNZ:
		// Emit nothing.
		break;
	case NOP:
		// Emit nothing.
		break;
	case CALL:
		LET_PC(R(RA));
		LET(RD, CONST(pc + INST_SIZE));
		break;
	case BL:
//		LET_PC(CONST(pc + simm(instr)));
		LET(RD, CONST(pc + INST_SIZE));
		break;
	case ADDI:
		LET(RD, ADD(R(RA), IMM));
		break;
	case ADD:
		LET(RD, ADD(R(RA), R(RB)));
		break;
	case SUB:
		LET(RD, SUB(R(RA), R(RB)));
		break;
	case AND:
		LET(RD, AND(R(RA), R(RB)));
		break;
	case OR:
		LET(RD, OR(R(RA), R(RB)));
		break;
	case NOT:
		LET(RD, COM(R(RA)));
		break;
	case SAL:
		LET(RD, SHL(R(RA), R(RB)));
		break;
	case SAR:
		LET(RD, ASHR(R(RA), R(RB)));
		break;
	case MUL:
		LET(RD, MUL(R(RA), R(RB)));
		break;
	}

	return INST_SIZE;
}
<commit_msg>fix build<commit_after>#include "llvm/IR/Instructions.h"

#define OPT_LOCAL_REGISTERS //XXX

#include "libcpu.h"
#include "libcpu_llvm.h"
#include "frontend.h"
#include "fapra_internal.h"

#include <inttypes.h>

using namespace llvm;

//////////////////////////////////////////////////////////////////////
// fapra: instruction decoding
//////////////////////////////////////////////////////////////////////

// Instruction decoding helper functions.
static inline uint32_t opc(uint32_t ins) {
  return ins >> 26;
}

static inline uint32_t rd(uint32_t ins) {
  return (ins >> 21) & 0x1F;
}

static inline uint32_t ra(uint32_t ins) {
  return (ins >> 16) & 0x1F;
}

static inline uint32_t rb(uint32_t ins) {
  return (ins >> 11) & 0x1F;
}

static inline sint32_t simm(uint32_t ins) {
  return ((int32_t) ((ins & 0xFFFF) << 16)) >> 16;
}

static inline uint32_t imm(uint32_t ins) {
  return ins & 0xFFFF;
}

#define RD ((instr >> 21) & 0x1F)
#define RA ((instr >> 16) & 0x1F)
#define RB ((instr >> 11) & 0x1F)
#define GetImmediate (instr & 0xFFFF)

#define INST_SIZE 4

//////////////////////////////////////////////////////////////////////
// tagging
//////////////////////////////////////////////////////////////////////

#include "tag.h"
int arch_fapra_tag_instr(cpu_t *cpu, addr_t pc, tag_t *tag, addr_t *new_pc,
						 addr_t *next_pc) {
	uint32_t ins = INSTR(pc);

	switch (opc(ins)) {
	case RFE:
	case PERM:
	case RDC8:
	case TGE:
	case TSE:
	default:
	  fprintf(stderr, "Illegal instruction!\n");
	  exit(EXIT_FAILURE);
	case LDW:
	case STW:
	case LDB:
	case STB:
	case LDIH:
	case LDIL:
	case ADDI:
	case ADD:
	case SUB:
	case AND:
	case OR:
	case NOT:
	case SARI:
	case SAL:
	case SAR:
	case MUL:
	case NOP:
		*tag = TAG_CONTINUE;
		break;
	case JMP:
		*tag = TAG_RET;
		break;
	case BRA:
		*tag = TAG_BRANCH;
		*new_pc = pc + simm(ins);
		break;
	case BZ:
	case BNZ:
		*tag = TAG_COND_BRANCH;
		*new_pc = pc + simm(ins);
		break;
	case CALL: {
		// Look for sequences like:
		//   ldih $X, 0x...
		//   ldil $X, 0x...
		//   call $Y, $X ($Y is the link register)

		// FIXME Make sure those two memory accesses are not out of bounds.
		uint32_t ldih = INSTR(pc - (INST_SIZE * 2));
		uint32_t ldil = INSTR(pc - INST_SIZE);

		if (opc(ldih) == LDIH && opc(ldil) == LDIL
			&& rd(ldih) == rd(ldil) && rd(ldih) == ra(ins)) {
			*new_pc = (imm(ldih) << 16) | imm(ldil);
		} else {
			*new_pc = NEW_PC_NONE;
		}

		*tag = TAG_CALL;
	}
		break;
	case BL:
		*tag = TAG_CALL;
		*new_pc = pc + simm(ins);
		break;
	}

	*next_pc = pc + INST_SIZE;

	return INST_SIZE;
}

//////////////////////////////////////////////////////////////////////

Value *
arch_fapra_get_imm(cpu_t *cpu, uint32_t instr, uint32_t bits, bool sext,
  BasicBlock *bb) {
	uint64_t imm;
	if (sext)
		imm = (uint64_t)(sint16_t)GetImmediate;
	else
		imm = (uint64_t)(uint16_t)GetImmediate;

	return ConstantInt::get(getIntegerType(bits? bits : cpu->info.word_size), imm);
}

#define IMM arch_fapra_get_imm(cpu, instr, 0, true, bb)
#define IMMU arch_fapra_get_imm(cpu, instr, 0, false, bb)

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

#define LET_PC(v) new StoreInst(v, cpu->ptr_PC, bb)

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

Value *
arch_fapra_translate_cond(cpu_t *cpu, addr_t pc, BasicBlock *bb)
{
	uint32_t instr = INSTR(pc);

	LOG("cond (%08" PRIx64 ") %08x\n", pc, instr);

	switch (opc(instr)) {
	default:
		fprintf(stderr, "Illegal instruction!\n");
		exit(EXIT_FAILURE);
	case BZ:
		// Emit nothing.
		return ICMP_EQ(R(RA), CONST(0));
		break;
	case BNZ:
		return ICMP_NE(R(RA), CONST(0));
		break;
	}
}

int
arch_fapra_translate_instr(cpu_t *cpu, addr_t pc, BasicBlock *bb)
{
#define BAD printf("%s:%d\n", __func__, __LINE__); exit(1);
#define LOGX LOG("%s:%d\n", __func__, __LINE__);

	uint32_t instr = INSTR(pc);

	LOG("translating (%08" PRIx64 ") %08x\n", pc, instr);

	switch (opc(instr)) {
	case PERM:
	case RDC8:
	case TGE:
	case TSE:
	case SARI:
	case RFE:
	default:
		fprintf(stderr, "Illegal instruction!\n");
		exit(EXIT_FAILURE);
	case LDW:
		LOAD32(RD, ADD(R(RA), IMM));
		break;
	case STW:
		STORE32(R(RD), ADD(R(RA), IMM));
		break;
	case LDB:
		LOAD8(RD, ADD(R(RA), IMM));
		break;
	case STB:
		STORE8(R(RD), ADD(R(RA), IMM));
		break;
	case LDIH:
		LET(RD, OR(AND(R(RD), CONST(0xFFFF)), CONST(GetImmediate << 16)));
		break;
	case LDIL:
		LET(RD, OR(AND(R(RD), CONST(0xFFFF0000)), IMMU));
		break;
	case JMP:
		LET_PC(R(RA));
		break;
	case BRA:
//		LET_PC(CONST(pc + simm(instr)));
		break;
	case BZ:
		// Emit nothing.
		break;
	case BNZ:
		// Emit nothing.
		break;
	case NOP:
		// Emit nothing.
		break;
	case CALL:
		LET_PC(R(RA));
		LET(RD, CONST(pc + INST_SIZE));
		break;
	case BL:
//		LET_PC(CONST(pc + simm(instr)));
		LET(RD, CONST(pc + INST_SIZE));
		break;
	case ADDI:
		LET(RD, ADD(R(RA), IMM));
		break;
	case ADD:
		LET(RD, ADD(R(RA), R(RB)));
		break;
	case SUB:
		LET(RD, SUB(R(RA), R(RB)));
		break;
	case AND:
		LET(RD, AND(R(RA), R(RB)));
		break;
	case OR:
		LET(RD, OR(R(RA), R(RB)));
		break;
	case NOT:
		LET(RD, COM(R(RA)));
		break;
	case SAL:
		LET(RD, SHL(R(RA), R(RB)));
		break;
	case SAR:
		LET(RD, ASHR(R(RA), R(RB)));
		break;
	case MUL:
		LET(RD, MUL(R(RA), R(RB)));
		break;
	}

	return INST_SIZE;
}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: tabvwshg.cxx,v $
 *
 *  $Revision: 1.12 $
 *
 *  last change: $Author: kz $ $Date: 2008-03-07 17:00:39 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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 for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"

// INCLUDE ---------------------------------------------------------------

//#define SI_VCDRAWOBJ

#include <tools/urlobj.hxx>
#include <svx/fmglob.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdpagv.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>

#include <com/sun/star/form/FormButtonType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XControlModel.hpp>

using namespace com::sun::star;

#include "tabvwsh.hxx"
#include "document.hxx"
#include "drawview.hxx"
#include "globstr.hrc"
#include <avmedia/mediawindow.hxx>

//------------------------------------------------------------------------

void ScTabViewShell::InsertURLButton( const String& rName, const String& rURL,
                                        const String& rTarget,
                                        const Point* pInsPos )
{
    //  Tabelle geschuetzt ?

    ScViewData* pViewData = GetViewData();
    ScDocument* pDoc = pViewData->GetDocument();
    SCTAB nTab = pViewData->GetTabNo();
    if ( pDoc->IsTabProtected(nTab) )
    {
        ErrorMessage(STR_PROTECTIONERR);
        return;
    }

    MakeDrawLayer();

    ScTabView*  pView   = pViewData->GetView();
//  SdrView*    pDrView = pView->GetSdrView();
    ScDrawView* pDrView = pView->GetScDrawView();
    SdrModel*   pModel  = pDrView->GetModel();

    SdrObject* pObj = SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
                               pDrView->GetSdrPageView()->GetPage(), pModel);
    SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);

    uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
    DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
    if( !xControlModel.is() )
        return;

    uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
    uno::Any aAny;

    aAny <<= rtl::OUString(rName);
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "Label" ), aAny );

    ::rtl::OUString aTmp = INetURLObject::GetAbsURL( pDoc->GetDocumentShell()->GetMedium()->GetBaseURL(), rURL );
    aAny <<= aTmp;
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "TargetURL" ), aAny );

    if( rTarget.Len() )
    {
        aAny <<= rtl::OUString(rTarget);
        xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "TargetFrame" ), aAny );
    }

    form::FormButtonType eButtonType = form::FormButtonType_URL;
    aAny <<= eButtonType;
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "ButtonType" ), aAny );

        if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
    {
        // #105638# OJ
        aAny <<= sal_True;
        xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aAny );
    }

    Point aPos;
    if (pInsPos)
        aPos = *pInsPos;
    else
        aPos = GetInsertPos();

    // Groesse wie in 3.1:
    Size aSize = GetActiveWin()->PixelToLogic(Size(140, 20));

    if ( pDoc->IsNegativePage(nTab) )
        aPos.X() -= aSize.Width();

    pObj->SetLogicRect(Rectangle(aPos, aSize));
//  pObj->Resize(Point(), Fraction(1, 1), Fraction(1, 1));

    //  am alten VC-Button musste die Position/Groesse nochmal explizit
    //  gesetzt werden - das scheint mit UnoControls nicht noetig zu sein

    //  nicht markieren wenn Ole
    pDrView->InsertObjectSafe( pObj, *pDrView->GetSdrPageView() );
}

<commit_msg>INTEGRATION: CWS changefileheader (1.12.34); FILE MERGED 2008/03/31 17:20:02 rt 1.12.34.1: #i87441# Change license header to LPGL v3.<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: tabvwshg.cxx,v $
 * $Revision: 1.13 $
 *
 * This file is part of OpenOffice.org.
 *
 * 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.
 *
 * 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).
 *
 * 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.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"

// INCLUDE ---------------------------------------------------------------

//#define SI_VCDRAWOBJ

#include <tools/urlobj.hxx>
#include <svx/fmglob.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdpagv.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>

#include <com/sun/star/form/FormButtonType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XControlModel.hpp>

using namespace com::sun::star;

#include "tabvwsh.hxx"
#include "document.hxx"
#include "drawview.hxx"
#include "globstr.hrc"
#include <avmedia/mediawindow.hxx>

//------------------------------------------------------------------------

void ScTabViewShell::InsertURLButton( const String& rName, const String& rURL,
                                        const String& rTarget,
                                        const Point* pInsPos )
{
    //  Tabelle geschuetzt ?

    ScViewData* pViewData = GetViewData();
    ScDocument* pDoc = pViewData->GetDocument();
    SCTAB nTab = pViewData->GetTabNo();
    if ( pDoc->IsTabProtected(nTab) )
    {
        ErrorMessage(STR_PROTECTIONERR);
        return;
    }

    MakeDrawLayer();

    ScTabView*  pView   = pViewData->GetView();
//  SdrView*    pDrView = pView->GetSdrView();
    ScDrawView* pDrView = pView->GetScDrawView();
    SdrModel*   pModel  = pDrView->GetModel();

    SdrObject* pObj = SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
                               pDrView->GetSdrPageView()->GetPage(), pModel);
    SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);

    uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
    DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
    if( !xControlModel.is() )
        return;

    uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
    uno::Any aAny;

    aAny <<= rtl::OUString(rName);
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "Label" ), aAny );

    ::rtl::OUString aTmp = INetURLObject::GetAbsURL( pDoc->GetDocumentShell()->GetMedium()->GetBaseURL(), rURL );
    aAny <<= aTmp;
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "TargetURL" ), aAny );

    if( rTarget.Len() )
    {
        aAny <<= rtl::OUString(rTarget);
        xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "TargetFrame" ), aAny );
    }

    form::FormButtonType eButtonType = form::FormButtonType_URL;
    aAny <<= eButtonType;
    xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "ButtonType" ), aAny );

        if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
    {
        // #105638# OJ
        aAny <<= sal_True;
        xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aAny );
    }

    Point aPos;
    if (pInsPos)
        aPos = *pInsPos;
    else
        aPos = GetInsertPos();

    // Groesse wie in 3.1:
    Size aSize = GetActiveWin()->PixelToLogic(Size(140, 20));

    if ( pDoc->IsNegativePage(nTab) )
        aPos.X() -= aSize.Width();

    pObj->SetLogicRect(Rectangle(aPos, aSize));
//  pObj->Resize(Point(), Fraction(1, 1), Fraction(1, 1));

    //  am alten VC-Button musste die Position/Groesse nochmal explizit
    //  gesetzt werden - das scheint mit UnoControls nicht noetig zu sein

    //  nicht markieren wenn Ole
    pDrView->InsertObjectSafe( pObj, *pDrView->GetSdrPageView() );
}

<|endoftext|>


<commit_before><commit_msg>RemoteFilesDialog: CMIS subtypes<commit_after><|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: svtaccessiblefactory.cxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2007-07-10 09:20:25 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library 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 for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"

#ifndef SVTOOLS_ACCESSIBLE_FACTORY_ACCESS_HXX
#include "svtaccessiblefactory.hxx"
#endif
#ifndef _OSL_MODULE_H_
#include <osl/module.h>
#endif

// #define UNLOAD_ON_LAST_CLIENT_DYING
    // this is not recommended currently. If enabled, the implementation will log
    // the number of active clients, and unload the acc library when the last client
    // goes away.
    // Sounds like a good idea, unfortunately, there's no guarantee that all objects
    // implemented in this library are already dead.
    // Iow, just because an object implementing an XAccessible (implemented in this lib
    // here) died, it's not said that everybody released all references to the
    // XAccessibleContext used by this component, and implemented in the acc lib.
    // So we cannot really unload the lib.
    //
    // Alternatively, if the lib would us own "usage counting", i.e. every component
    // implemented therein would affect a static ref count, the acc lib could care
    // for unloading itself.

//........................................................................
namespace svt
{
//........................................................................

    using namespace ::com::sun::star::uno;
    using namespace ::com::sun::star::awt;
    using namespace ::com::sun::star::accessibility;

    namespace
    {
#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        static oslInterlockedCount                      s_nAccessibleFactoryAccesss = 0;
#endif // UNLOAD_ON_LAST_CLIENT_DYING
        static oslModule                                s_hAccessibleImplementationModule = NULL;
        static GetSvtAccessibilityComponentFactory      s_pAccessibleFactoryFunc = NULL;
        static ::rtl::Reference< IAccessibleFactory >   s_pFactory;

        //====================================================================
        //= AccessibleDummyFactory
        //====================================================================
        class AccessibleDummyFactory : public IAccessibleFactory
        {
        public:
            AccessibleDummyFactory();

        protected:
            virtual ~AccessibleDummyFactory();

        private:
            AccessibleDummyFactory( const AccessibleDummyFactory& );            // never implemented
            AccessibleDummyFactory& operator=( const AccessibleDummyFactory& ); // never implemented

            oslInterlockedCount m_refCount;

        public:
            // IReference
            virtual oslInterlockedCount SAL_CALL acquire();
            virtual oslInterlockedCount SAL_CALL release();

            // IAccessibleFactory
            virtual IAccessibleTabListBox*
                createAccessibleTabListBox(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    SvHeaderTabListBox& /*rBox*/
                ) const
            {
                return NULL;
            }

            virtual IAccessibleBrowseBox*
                createAccessibleBrowseBox(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleIconChoiceCtrl(
                    SvtIconChoiceCtrl& /*_rIconCtrl*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_xParent*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleTabBar(
                    TabBar& /*_rTabBar*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
                createAccessibleTextWindowContext(
                    VCLXWindow* /*pVclXWindow*/, TextEngine& /*rEngine*/, TextView& /*rView*/, bool /*bCompoundControlChild*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleTreeListBox(
                    SvTreeListBox& /*_rListBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_xParent*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxHeaderBar(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    IAccessibleTableProvider& /*_rOwningTable*/,
                    AccessibleBrowseBoxObjType /*_eObjType*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxTableCell(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    sal_Int32 /*_nRowId*/,
                    sal_uInt16 /*_nColId*/,
                    sal_Int32 /*_nOffset*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxHeaderCell(
                    sal_Int32 /*_nColumnRowId*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    AccessibleBrowseBoxObjType  /*_eObjType*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleCheckBoxCell(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    sal_Int32 /*_nRowPos*/,
                    sal_uInt16 /*_nColPos*/,
                    const TriState& /*_eState*/,
                    sal_Bool /*_bEnabled*/,
                    sal_Bool /*_bIsTriState*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createEditBrowseBoxTableCellAccess(
                    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& /*_rxControlAccessible*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_rxFocusWindow*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    sal_Int32 /*_nRowPos*/,
                    sal_uInt16 /*_nColPos*/
                ) const
            {
                return NULL;
            }
        };

        //----------------------------------------------------------------
        AccessibleDummyFactory::AccessibleDummyFactory()
        {
        }

        //----------------------------------------------------------------
        AccessibleDummyFactory::~AccessibleDummyFactory()
        {
        }

        //----------------------------------------------------------------
        oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
        {
            return osl_incrementInterlockedCount( &m_refCount );
        }

        //----------------------------------------------------------------
        oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
        {
            if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
            {
                delete this;
                return 0;
            }
            return m_refCount;
        }
    }

    //====================================================================
    //= AccessibleFactoryAccess
    //====================================================================
    //--------------------------------------------------------------------
    AccessibleFactoryAccess::AccessibleFactoryAccess()
        :m_bInitialized( false )
    {
    }

    //--------------------------------------------------------------------
    void AccessibleFactoryAccess::ensureInitialized()
    {
        if ( m_bInitialized )
            return;

        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );

#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        if ( 1 == osl_incrementInterlockedCount( &s_nAccessibleFactoryAccesss ) )
        {   // the first client
#endif // UNLOAD_ON_LAST_CLIENT_DYING
            // load the library implementing the factory
            if ( !s_pFactory.get() )
            {
                const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
                    SVLIBRARY( "acc" )
                );
                s_hAccessibleImplementationModule = osl_loadModule( sModuleName.pData, 0 );
                if ( s_hAccessibleImplementationModule != NULL )
                {
                    const ::rtl::OUString sFactoryCreationFunc =
                        ::rtl::OUString::createFromAscii( "getSvtAccessibilityComponentFactory" );
                    s_pAccessibleFactoryFunc = (GetSvtAccessibilityComponentFactory)
                        osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );

                }
                OSL_ENSURE( s_pAccessibleFactoryFunc, "ac_registerClient: could not load the library, or not retrieve the needed symbol!" );

                // get a factory instance
                if ( s_pAccessibleFactoryFunc )
                {
                    IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
                    if ( pFactory )
                    {
                        s_pFactory = pFactory;
                        pFactory->release();
                    }
                }
            }

            if ( !s_pFactory.get() )
                // the attempt to load the lib, or to create the factory, failed
                // -> fall back to a dummy factory
                s_pFactory = new AccessibleDummyFactory;
#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        }
#endif

        m_bInitialized = true;
    }

    //--------------------------------------------------------------------
    AccessibleFactoryAccess::~AccessibleFactoryAccess()
    {
        if ( m_bInitialized )
        {
            ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );

#ifdef UNLOAD_ON_LAST_CLIENT_DYING
            if( 0 == osl_decrementInterlockedCount( &s_nAccessibleFactoryAccesss ) )
            {
                s_pFactory = NULL;
                s_pAccessibleFactoryFunc = NULL;
                if ( s_hAccessibleImplementationModule )
                {
                    osl_unloadModule( s_hAccessibleImplementationModule );
                    s_hAccessibleImplementationModule = NULL;
                }
            }
#endif // UNLOAD_ON_LAST_CLIENT_DYING
        }
    }

    //--------------------------------------------------------------------
    IAccessibleFactory& AccessibleFactoryAccess::getFactory()
    {
        ensureInitialized();
        DBG_ASSERT( s_pFactory.is(), "AccessibleFactoryAccess::getFactory: at least a dummy factory should have been created!" );
        return *s_pFactory;
    }

//........................................................................
}   // namespace svt
//........................................................................
<commit_msg>INTEGRATION: CWS finalsisslremoval (1.3.14); FILE MERGED 2007/07/15 08:00:02 pjanik 1.3.14.1: #i79627#: Remove SISSL.<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: svtaccessiblefactory.cxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: obo $ $Date: 2007-07-18 10:04:42 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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 for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"

#ifndef SVTOOLS_ACCESSIBLE_FACTORY_ACCESS_HXX
#include "svtaccessiblefactory.hxx"
#endif
#ifndef _OSL_MODULE_H_
#include <osl/module.h>
#endif

// #define UNLOAD_ON_LAST_CLIENT_DYING
    // this is not recommended currently. If enabled, the implementation will log
    // the number of active clients, and unload the acc library when the last client
    // goes away.
    // Sounds like a good idea, unfortunately, there's no guarantee that all objects
    // implemented in this library are already dead.
    // Iow, just because an object implementing an XAccessible (implemented in this lib
    // here) died, it's not said that everybody released all references to the
    // XAccessibleContext used by this component, and implemented in the acc lib.
    // So we cannot really unload the lib.
    //
    // Alternatively, if the lib would us own "usage counting", i.e. every component
    // implemented therein would affect a static ref count, the acc lib could care
    // for unloading itself.

//........................................................................
namespace svt
{
//........................................................................

    using namespace ::com::sun::star::uno;
    using namespace ::com::sun::star::awt;
    using namespace ::com::sun::star::accessibility;

    namespace
    {
#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        static oslInterlockedCount                      s_nAccessibleFactoryAccesss = 0;
#endif // UNLOAD_ON_LAST_CLIENT_DYING
        static oslModule                                s_hAccessibleImplementationModule = NULL;
        static GetSvtAccessibilityComponentFactory      s_pAccessibleFactoryFunc = NULL;
        static ::rtl::Reference< IAccessibleFactory >   s_pFactory;

        //====================================================================
        //= AccessibleDummyFactory
        //====================================================================
        class AccessibleDummyFactory : public IAccessibleFactory
        {
        public:
            AccessibleDummyFactory();

        protected:
            virtual ~AccessibleDummyFactory();

        private:
            AccessibleDummyFactory( const AccessibleDummyFactory& );            // never implemented
            AccessibleDummyFactory& operator=( const AccessibleDummyFactory& ); // never implemented

            oslInterlockedCount m_refCount;

        public:
            // IReference
            virtual oslInterlockedCount SAL_CALL acquire();
            virtual oslInterlockedCount SAL_CALL release();

            // IAccessibleFactory
            virtual IAccessibleTabListBox*
                createAccessibleTabListBox(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    SvHeaderTabListBox& /*rBox*/
                ) const
            {
                return NULL;
            }

            virtual IAccessibleBrowseBox*
                createAccessibleBrowseBox(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleIconChoiceCtrl(
                    SvtIconChoiceCtrl& /*_rIconCtrl*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_xParent*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleTabBar(
                    TabBar& /*_rTabBar*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
                createAccessibleTextWindowContext(
                    VCLXWindow* /*pVclXWindow*/, TextEngine& /*rEngine*/, TextView& /*rView*/, bool /*bCompoundControlChild*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleTreeListBox(
                    SvTreeListBox& /*_rListBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_xParent*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxHeaderBar(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    IAccessibleTableProvider& /*_rOwningTable*/,
                    AccessibleBrowseBoxObjType /*_eObjType*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxTableCell(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    sal_Int32 /*_nRowId*/,
                    sal_uInt16 /*_nColId*/,
                    sal_Int32 /*_nOffset*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleBrowseBoxHeaderCell(
                    sal_Int32 /*_nColumnRowId*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    AccessibleBrowseBoxObjType  /*_eObjType*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createAccessibleCheckBoxCell(
                    const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_xFocusWindow*/,
                    sal_Int32 /*_nRowPos*/,
                    sal_uInt16 /*_nColPos*/,
                    const TriState& /*_eState*/,
                    sal_Bool /*_bEnabled*/,
                    sal_Bool /*_bIsTriState*/
                ) const
            {
                return NULL;
            }

            virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                createEditBrowseBoxTableCellAccess(
                    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
                    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& /*_rxControlAccessible*/,
                    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& /*_rxFocusWindow*/,
                    IAccessibleTableProvider& /*_rBrowseBox*/,
                    sal_Int32 /*_nRowPos*/,
                    sal_uInt16 /*_nColPos*/
                ) const
            {
                return NULL;
            }
        };

        //----------------------------------------------------------------
        AccessibleDummyFactory::AccessibleDummyFactory()
        {
        }

        //----------------------------------------------------------------
        AccessibleDummyFactory::~AccessibleDummyFactory()
        {
        }

        //----------------------------------------------------------------
        oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
        {
            return osl_incrementInterlockedCount( &m_refCount );
        }

        //----------------------------------------------------------------
        oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
        {
            if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
            {
                delete this;
                return 0;
            }
            return m_refCount;
        }
    }

    //====================================================================
    //= AccessibleFactoryAccess
    //====================================================================
    //--------------------------------------------------------------------
    AccessibleFactoryAccess::AccessibleFactoryAccess()
        :m_bInitialized( false )
    {
    }

    //--------------------------------------------------------------------
    void AccessibleFactoryAccess::ensureInitialized()
    {
        if ( m_bInitialized )
            return;

        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );

#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        if ( 1 == osl_incrementInterlockedCount( &s_nAccessibleFactoryAccesss ) )
        {   // the first client
#endif // UNLOAD_ON_LAST_CLIENT_DYING
            // load the library implementing the factory
            if ( !s_pFactory.get() )
            {
                const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
                    SVLIBRARY( "acc" )
                );
                s_hAccessibleImplementationModule = osl_loadModule( sModuleName.pData, 0 );
                if ( s_hAccessibleImplementationModule != NULL )
                {
                    const ::rtl::OUString sFactoryCreationFunc =
                        ::rtl::OUString::createFromAscii( "getSvtAccessibilityComponentFactory" );
                    s_pAccessibleFactoryFunc = (GetSvtAccessibilityComponentFactory)
                        osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );

                }
                OSL_ENSURE( s_pAccessibleFactoryFunc, "ac_registerClient: could not load the library, or not retrieve the needed symbol!" );

                // get a factory instance
                if ( s_pAccessibleFactoryFunc )
                {
                    IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
                    if ( pFactory )
                    {
                        s_pFactory = pFactory;
                        pFactory->release();
                    }
                }
            }

            if ( !s_pFactory.get() )
                // the attempt to load the lib, or to create the factory, failed
                // -> fall back to a dummy factory
                s_pFactory = new AccessibleDummyFactory;
#ifdef UNLOAD_ON_LAST_CLIENT_DYING
        }
#endif

        m_bInitialized = true;
    }

    //--------------------------------------------------------------------
    AccessibleFactoryAccess::~AccessibleFactoryAccess()
    {
        if ( m_bInitialized )
        {
            ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );

#ifdef UNLOAD_ON_LAST_CLIENT_DYING
            if( 0 == osl_decrementInterlockedCount( &s_nAccessibleFactoryAccesss ) )
            {
                s_pFactory = NULL;
                s_pAccessibleFactoryFunc = NULL;
                if ( s_hAccessibleImplementationModule )
                {
                    osl_unloadModule( s_hAccessibleImplementationModule );
                    s_hAccessibleImplementationModule = NULL;
                }
            }
#endif // UNLOAD_ON_LAST_CLIENT_DYING
        }
    }

    //--------------------------------------------------------------------
    IAccessibleFactory& AccessibleFactoryAccess::getFactory()
    {
        ensureInitialized();
        DBG_ASSERT( s_pFactory.is(), "AccessibleFactoryAccess::getFactory: at least a dummy factory should have been created!" );
        return *s_pFactory;
    }

//........................................................................
}   // namespace svt
//........................................................................
<|endoftext|>


<commit_before>/**
 * This file contains functions to create and save a png file
 */

#include "png.h"

#ifndef Z_BEST_SPEED
#define Z_BEST_SPEED 6
#endif

namespace PNG {

PNG::PNG(const std::filesystem::path &file) : file(file), imageHandle(nullptr) {
  set_type(UNKNOWN);
  _line = _height = _width = _padding = 0;
  pngPtr = NULL;
  pngInfoPtr = NULL;
}

void PNG::_close() {
  if (imageHandle) {
    fclose(imageHandle);
    imageHandle = nullptr;
  }

  _line = 0;
}

bool PNG::error_callback() {
  // libpng will issue a longjmp on error, so code flow will end up here if
  // something goes wrong in the code below
  if (setjmp(png_jmpbuf(pngPtr))) {
    logger::error("libpng encountered an error\n");
    return true;
  }

  return false;
}

ColorType PNG::set_type(int type) {
  switch (type) {
  case GRAYSCALEALPHA:
    _type = GRAYSCALEALPHA;
    _bytesPerPixel = 2;
    break;

  case GRAYSCALE:
    _type = GRAYSCALE;
    _bytesPerPixel = 1;
    break;

  case PALETTE:
    _type = PALETTE;
    _bytesPerPixel = 1;
    break;

  case RGB:
    _type = RGB;
    _bytesPerPixel = 3;
    break;

  case RGBA:
    _type = RGBA;
    _bytesPerPixel = 4;
    break;

  default:
    _type = UNKNOWN;
    _bytesPerPixel = 0;
  }

  return _type;
}

PNGWriter::PNGWriter(const std::filesystem::path &file) : super::PNG(file) {
  buffer = nullptr;
  set_type(RGBA);
}

PNGWriter::~PNGWriter() {
  if (buffer)
    delete[] buffer;
}

void PNGWriter::_close() {
  png_write_end(pngPtr, NULL);
  png_destroy_write_struct(&pngPtr, &pngInfoPtr);

  super::_close();
}

void PNGWriter::set_text(const Comments &_comments) { comments = _comments; }

void write_text(png_structp pngPtr, png_infop pngInfoPtr,
                const Comments &comments) {
  std::vector<png_text> text(comments.size());
  size_t index = 0;

  for (auto const &pair : comments) {
    text[index].compression = PNG_TEXT_COMPRESSION_NONE;
    text[index].key = (png_charp)pair.first.c_str();
    text[index].text = (png_charp)pair.second.c_str();
    text[index].text_length = pair.second.length();

    index++;
  }

  png_set_text(pngPtr, pngInfoPtr, &text[0], text.size());
}

void PNGWriter::_open() {
  if (!(super::imageHandle = fopen(file.string().c_str(), "wb"))) {
    throw(std::runtime_error("Error opening '" + file.string() +
                             "' for writing: " + std::string(strerror(errno))));
  }

  if (!(get_width() || get_height())) {
    logger::warn("Nothing to output: canvas is empty !\n");
    return;
  }

  logger::deep_debug("PNGWriter: image {}x{}, {}bpp\n", get_width(),
                     get_height(), 8 * _bytesPerPixel);

  FSEEK(imageHandle, 0, SEEK_SET);

  // Write header
  pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);

  if (error_callback())
    return;

  if (pngPtr == NULL) {
    return;
  }

  pngInfoPtr = png_create_info_struct(pngPtr);

  if (pngInfoPtr == NULL) {
    png_destroy_write_struct(&pngPtr, NULL);
    return;
  }

  png_init_io(pngPtr, imageHandle);

  write_text(pngPtr, pngInfoPtr, comments);

  // The png file format works by having blocks piled up in a certain order.
  // Check out http://www.libpng.org/pub/png/book/chapter11.html for more
  // info.

  // First, dump the required IHDR block.
  png_set_IHDR(pngPtr, pngInfoPtr, get_width(), get_height(), 8,
               PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
               PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);

  png_write_info(pngPtr, pngInfoPtr);

  return;
}

void PNGWriter::pad() {
  getBuffer();
  memset(buffer, 0, row_size());
  for (size_t k = 0; k < _padding; k++)
    png_write_row(pngPtr, (png_bytep)buffer);
}

uint8_t *PNGWriter::getBuffer() {
  if (!buffer) {
    buffer = new uint8_t[row_size()];
    memset(buffer, 0, row_size());
  }

  return buffer + _padding * _bytesPerPixel;
}

uint32_t PNGWriter::writeLine() {
  if (!_line++) {
    _open();
    pad();
  }

  png_write_row(pngPtr, (png_bytep)buffer);

  if (_line == _height) {
    pad();
    _close();
  }

  return row_size();
}

PNGReader::PNGReader(const std::filesystem::path &file) : PNG(file) {
  _open();
  _close();
}

PNGReader::PNGReader(const PNGReader &other) : PNG(other.file) {}

PNGReader::~PNGReader() {}

void PNGReader::_close() {
  png_destroy_read_struct(&pngPtr, &pngInfoPtr, NULL);
  super::_close();
}

void PNGReader::_open() {
  if (!(super::imageHandle = fopen(file.string().c_str(), "rb"))) {
    throw(std::runtime_error("Error opening '" + file.string() +
                             "' for reading: " + std::string(strerror(errno))));
  }

  // Check the validity of the header
  png_byte header[8];
  if (fread(header, 1, 8, imageHandle) != 8 || !png_check_sig(header, 8)) {
    logger::error("PNGReader: File {} is not a PNG\n", file.string());
    return;
  }

  pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  // Tell libpng the file's header has been handled
  png_set_sig_bytes(pngPtr, 8);

  if (pngPtr == NULL || error_callback()) {
    logger::error("PNGReader: Error reading {}\n", file.string());
    return;
  }

  pngInfoPtr = png_create_info_struct(pngPtr);

  png_uint_32 width, height;
  int type, interlace, comp, filter, _bitDepth;

  png_init_io(pngPtr, imageHandle);

  png_read_info(pngPtr, pngInfoPtr);

  // Check image format (square, RGBA)
  png_uint_32 ret = png_get_IHDR(pngPtr, pngInfoPtr, &width, &height,
                                 &_bitDepth, &type, &interlace, &comp, &filter);
  if (ret == 0) {
    logger::error("Error getting IDHR block of file\n");
    png_destroy_read_struct(&pngPtr, &pngInfoPtr, NULL);
    return;
  }

  // Use the gathered info to fill the struct
  _width = width;
  _height = height;

  set_type(type);

  logger::deep_debug("PNGReader: PNG file of size {}x{}, {}bpp\n", get_width(),
                     get_height(), 8 * _bytesPerPixel);
}

uint32_t PNGReader::getLine(uint8_t *buffer, size_t size) {
  // Open and initialize if this is the first read
  if (!_line++)
    _open();

  if (size < get_width()) {
    logger::error("Buffer too small");
    return 0;
  }

  png_bytep row_pointer = (png_bytep)buffer;

  png_read_row(pngPtr, row_pointer, NULL);

  if (_line == _height)
    _close();

  return get_width();
}

} // namespace PNG
<commit_msg>Updated PNG status and errors<commit_after>/**
 * This file contains functions to create and save a png file
 */

#include "png.h"

#ifndef Z_BEST_SPEED
#define Z_BEST_SPEED 6
#endif

namespace PNG {

PNG::PNG(const std::filesystem::path &file) : file(file), imageHandle(nullptr) {
  set_type(UNKNOWN);
  _line = _height = _width = _padding = 0;
  pngPtr = NULL;
  pngInfoPtr = NULL;
}

void PNG::_close() {
  if (imageHandle) {
    fclose(imageHandle);
    imageHandle = nullptr;
  }

  _line = 0;
}

bool PNG::error_callback() {
  // libpng will issue a longjmp on error, so code flow will end up here if
  // something goes wrong in the code below
  if (setjmp(png_jmpbuf(pngPtr))) {
    logger::error("[PNG] libpng encountered an error\n");
    return true;
  }

  return false;
}

ColorType PNG::set_type(int type) {
  switch (type) {
  case GRAYSCALEALPHA:
    _type = GRAYSCALEALPHA;
    _bytesPerPixel = 2;
    break;

  case GRAYSCALE:
    _type = GRAYSCALE;
    _bytesPerPixel = 1;
    break;

  case PALETTE:
    _type = PALETTE;
    _bytesPerPixel = 1;
    break;

  case RGB:
    _type = RGB;
    _bytesPerPixel = 3;
    break;

  case RGBA:
    _type = RGBA;
    _bytesPerPixel = 4;
    break;

  default:
    _type = UNKNOWN;
    _bytesPerPixel = 0;
  }

  return _type;
}

PNGWriter::PNGWriter(const std::filesystem::path &file) : super::PNG(file) {
  buffer = nullptr;
  set_type(RGBA);
}

PNGWriter::~PNGWriter() {
  if (buffer)
    delete[] buffer;
}

void PNGWriter::_close() {
  png_write_end(pngPtr, NULL);
  png_destroy_write_struct(&pngPtr, &pngInfoPtr);

  super::_close();
}

void PNGWriter::set_text(const Comments &_comments) { comments = _comments; }

void write_text(png_structp pngPtr, png_infop pngInfoPtr,
                const Comments &comments) {
  std::vector<png_text> text(comments.size());
  size_t index = 0;

  for (auto const &pair : comments) {
    text[index].compression = PNG_TEXT_COMPRESSION_NONE;
    text[index].key = (png_charp)pair.first.c_str();
    text[index].text = (png_charp)pair.second.c_str();
    text[index].text_length = pair.second.length();

    index++;
  }

  png_set_text(pngPtr, pngInfoPtr, &text[0], text.size());
}

void PNGWriter::_open() {
  if (!(get_width() || get_height())) {
    logger::warn("[PNGWriter] Nothing to output: canvas is empty !\n");
    return;
  }

  logger::deep_debug("[PNGWriter] image {}x{}, {}bpp, writing to {}\n",
                     get_width(), get_height(), 8 * _bytesPerPixel,
                     file.string());

  if (!(super::imageHandle = fopen(file.c_str(), "wb"))) {
    logger::error("[PNGWriter] Error opening '{}' for writing: {}\n",
                  file.string(), strerror(errno));
    return;
  }

  FSEEK(imageHandle, 0, SEEK_SET);

  // Write header
  pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);

  if (error_callback())
    return;

  if (pngPtr == NULL) {
    return;
  }

  pngInfoPtr = png_create_info_struct(pngPtr);

  if (pngInfoPtr == NULL) {
    png_destroy_write_struct(&pngPtr, NULL);
    return;
  }

  png_init_io(pngPtr, imageHandle);

  write_text(pngPtr, pngInfoPtr, comments);

  // The png file format works by having blocks piled up in a certain order.
  // Check out http://www.libpng.org/pub/png/book/chapter11.html for more
  // info.

  // First, dump the required IHDR block.
  png_set_IHDR(pngPtr, pngInfoPtr, get_width(), get_height(), 8,
               PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
               PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);

  png_write_info(pngPtr, pngInfoPtr);

  return;
}

void PNGWriter::pad() {
  getBuffer();
  memset(buffer, 0, row_size());
  for (size_t k = 0; k < _padding; k++)
    png_write_row(pngPtr, (png_bytep)buffer);
}

uint8_t *PNGWriter::getBuffer() {
  if (!buffer) {
    buffer = new uint8_t[row_size()];
    memset(buffer, 0, row_size());
  }

  return buffer + _padding * _bytesPerPixel;
}

uint32_t PNGWriter::writeLine() {
  if (!_line++) {
    _open();
    pad();
  }

  png_write_row(pngPtr, (png_bytep)buffer);

  if (_line == _height) {
    pad();
    _close();
  }

  return row_size();
}

PNGReader::PNGReader(const std::filesystem::path &file) : PNG(file) {
  _open();
  _close();
}

PNGReader::PNGReader(const PNGReader &other) : PNG(other.file) {}

PNGReader::~PNGReader() {}

void PNGReader::_close() {
  png_destroy_read_struct(&pngPtr, &pngInfoPtr, NULL);
  super::_close();
}

void PNGReader::_open() {
  logger::deep_debug("[PNGReader] Opening '{}'\n", file.string());

  if (!(super::imageHandle = fopen(file.string().c_str(), "rb"))) {
    logger::error("[PNGReader] Error opening '{}' for reading: {}\n",
                  file.string(), strerror(errno));
    return;
  }

  // Check the validity of the header
  png_byte header[8];
  if (fread(header, 1, 8, imageHandle) != 8 || !png_check_sig(header, 8)) {
    logger::error("[PNGReader] File '{}' is not a PNG\n", file.string());
    return;
  }

  pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  // Tell libpng the file's header has been handled
  png_set_sig_bytes(pngPtr, 8);

  if (pngPtr == NULL || error_callback()) {
    logger::error("[PNGReader] Error reading '{}'\n", file.string());
    return;
  }

  pngInfoPtr = png_create_info_struct(pngPtr);

  png_uint_32 width, height;
  int type, interlace, comp, filter, _bitDepth;

  png_init_io(pngPtr, imageHandle);

  png_read_info(pngPtr, pngInfoPtr);

  // Check image format (square, RGBA)
  png_uint_32 ret = png_get_IHDR(pngPtr, pngInfoPtr, &width, &height,
                                 &_bitDepth, &type, &interlace, &comp, &filter);
  if (ret == 0) {
    logger::error("[PNGReader] Error getting IDHR block of '{}'\n",
                  file.string());
    png_destroy_read_struct(&pngPtr, &pngInfoPtr, NULL);
    return;
  }

  // Use the gathered info to fill the struct
  _width = width;
  _height = height;

  set_type(type);

  logger::deep_debug("[PNGReader] '{}': PNG file of size {}x{}, {}bpp\n",
                     file.string(), get_width(), get_height(),
                     8 * _bytesPerPixel);
}

uint32_t PNGReader::getLine(uint8_t *buffer, size_t size) {
  // Open and initialize if this is the first read
  if (!_line++)
    _open();

  if (size < get_width()) {
    logger::error("[PNGReader] Buffer too small reading '{}' !\n",
                  file.string());
    return 0;
  }

  png_bytep row_pointer = (png_bytep)buffer;

  png_read_row(pngPtr, row_pointer, NULL);

  if (_line == _height)
    _close();

  return get_width();
}

} // namespace PNG
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: pageproperties.cxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-09 00:15:40 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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 for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _SDR_PROPERTIES_PAGEPROPERTIES_HXX
#include <svx/sdr/properties/pageproperties.hxx>
#endif

#ifndef _SFXITEMSET_HXX
#include <svtools/itemset.hxx>
#endif

#ifndef _SVDOBJ_HXX
#include <svdobj.hxx>
#endif

#ifndef _SVDPOOL_HXX
#include <svdpool.hxx>
#endif

//////////////////////////////////////////////////////////////////////////////

namespace sdr
{
    namespace properties
    {
        // create a new itemset
        SfxItemSet& PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
            // overloaded to legally return a valid ItemSet
            return *(new SfxItemSet(rPool));
        }

        PageProperties::PageProperties(SdrObject& rObj)
        :   EmptyProperties(rObj)
        {
        }

        PageProperties::PageProperties(const PageProperties& rProps, SdrObject& rObj)
        :   EmptyProperties(rProps, rObj)
        {
        }

        PageProperties::~PageProperties()
        {
        }

        BaseProperties& PageProperties::Clone(SdrObject& rObj) const
        {
            return *(new PageProperties(*this, rObj));
        }

        // get itemset. Overloaded here to allow creating the empty itemset
        // without asserting
        const SfxItemSet& PageProperties::GetObjectItemSet() const
        {
            if(!mpEmptyItemSet)
            {
                ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
            }

            DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");

            return *mpEmptyItemSet;
        }

        void PageProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
        {
            // #86481# simply ignore item setting on page objects
        }

        SfxStyleSheet* PageProperties::GetStyleSheet() const
        {
            // overloaded to legally return a 0L pointer here
            return 0L;
        }

        void PageProperties::ClearObjectItem(const sal_uInt16 nWhich)
        {
            // simply ignore item clearing on page objects
        }
    } // end of namespace properties
} // end of namespace sdr

////////////////////////////////////////////////////////////////////////////////////////////////////

// eof
<commit_msg>INTEGRATION: CWS warnings01 (1.5.222); FILE MERGED 2006/02/21 16:59:34 aw 1.5.222.1: #i55991# Adaptions to warning free code<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: pageproperties.cxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: hr $ $Date: 2006-06-19 16:31:11 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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 for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _SDR_PROPERTIES_PAGEPROPERTIES_HXX
#include <svx/sdr/properties/pageproperties.hxx>
#endif

#ifndef _SFXITEMSET_HXX
#include <svtools/itemset.hxx>
#endif

#ifndef _SVDOBJ_HXX
#include <svdobj.hxx>
#endif

#ifndef _SVDPOOL_HXX
#include <svdpool.hxx>
#endif

//////////////////////////////////////////////////////////////////////////////

namespace sdr
{
    namespace properties
    {
        // create a new itemset
        SfxItemSet& PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
            // overloaded to legally return a valid ItemSet
            return *(new SfxItemSet(rPool));
        }

        PageProperties::PageProperties(SdrObject& rObj)
        :   EmptyProperties(rObj)
        {
        }

        PageProperties::PageProperties(const PageProperties& rProps, SdrObject& rObj)
        :   EmptyProperties(rProps, rObj)
        {
        }

        PageProperties::~PageProperties()
        {
        }

        BaseProperties& PageProperties::Clone(SdrObject& rObj) const
        {
            return *(new PageProperties(*this, rObj));
        }

        // get itemset. Overloaded here to allow creating the empty itemset
        // without asserting
        const SfxItemSet& PageProperties::GetObjectItemSet() const
        {
            if(!mpEmptyItemSet)
            {
                ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
            }

            DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");

            return *mpEmptyItemSet;
        }

        void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
        {
            // #86481# simply ignore item setting on page objects
        }

        SfxStyleSheet* PageProperties::GetStyleSheet() const
        {
            // overloaded to legally return a 0L pointer here
            return 0L;
        }

        void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
        {
            // simply ignore item clearing on page objects
        }
    } // end of namespace properties
} // end of namespace sdr

////////////////////////////////////////////////////////////////////////////////////////////////////

// eof
<|endoftext|>


<commit_before><commit_msg>ww8: warning C4701: potentially uninitialized local variable<commit_after><|endoftext|>


<commit_before>#include "scenetree.h"

#include <game/gameserver.h>
#include <game/digitanks/digitanksgame.h>
#include "digitankswindow.h"
#include "hud.h"
#include <renderer\renderer.h>
#include <game/digitanks/dt_camera.h>
#include "instructor.h"

CSceneTree::CSceneTree()
	: CTree(CRenderer::LoadTextureIntoGL(L"textures/hud/arrow.png"), 0, 0)
{
}

void CSceneTree::Layout()
{
	SetSize(90, glgui::CRootPanel::Get()->GetHeight()-300);
	SetPos(15, 60);

	BaseClass::Layout();
}

void CSceneTree::BuildTree(bool bForce)
{
	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	if (!pCurrentLocalTeam)
		return;

	if (m_hTeam == pCurrentLocalTeam && !bForce)
		return;

	ClearTree();

	m_hTeam = pCurrentLocalTeam;

	for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
	{
		CSelectable* pEntity = CBaseEntity::GetEntityType<CSelectable>(i);
		if (!pEntity)
			continue;

		if (pEntity->GetDigitanksTeam() != pCurrentLocalTeam)
			continue;

		unittype_t eUnit = pEntity->GetUnitType();

		CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

		pTreeGroup->AddNode(new CSceneTreeUnit(pEntity, pTreeGroup, this));
	}

	Layout();
}

CSceneTreeGroup* CSceneTree::GetUnitNode(unittype_t eUnit)
{
	for (size_t i = 0; i < m_apNodes.size(); i++)
	{
		CSceneTreeGroup* pTreeGroup = dynamic_cast<CSceneTreeGroup*>(m_apNodes[i]);
		if (eUnit == pTreeGroup->GetUnitType())
			return pTreeGroup;
	}

	// It's not there. Insert it.
	for (size_t i = 0; i < m_apNodes.size(); i++)
	{
		CSceneTreeGroup* pTreeGroup = dynamic_cast<CSceneTreeGroup*>(m_apNodes[i]);
		if (eUnit < pTreeGroup->GetUnitType())
		{
			CSceneTreeGroup* pReturn = new CSceneTreeGroup(eUnit, this);
			AddNode(pReturn, i);
			return pReturn;
		}
	}

	CSceneTreeGroup* pReturn = new CSceneTreeGroup(eUnit, this);
	AddNode(pReturn);
	return pReturn;
}

void CSceneTree::Paint(int x, int y, int w, int h)
{
	glgui::CRootPanel::PaintRect(x, y, w, h, m_clrBackground);

	if (m_iHilighted != ~0)
	{
		IControl* pNode = m_apControls[m_iHilighted];
		int cx, cy, cw, ch;
		pNode->GetAbsDimensions(cx, cy, cw, ch);
		glgui::CRootPanel::PaintRect(cx+ch, cy, ch, ch, Color(255, 255, 255, 100));
	}

	// Skip CTree, we override its hilight and selection methods.
	CPanel::Paint(x, y, w, h);
}

void CSceneTree::OnAddEntityToTeam(CDigitanksTeam* pTeam, CBaseEntity* pEntity)
{
	CSelectable* pSelectable = dynamic_cast<CSelectable*>(pEntity);
	if (!pSelectable)
		return;

	if (pTeam != m_hTeam)
		return;

	unittype_t eUnit = pSelectable->GetUnitType();
	CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

	pTreeGroup->AddNode(new CSceneTreeUnit(pSelectable, pTreeGroup, this));

	Layout();
}

void CSceneTree::OnRemoveEntityFromTeam(CDigitanksTeam* pTeam, CBaseEntity* pEntity)
{
	CSelectable* pSelectable = dynamic_cast<CSelectable*>(pEntity);
	if (!pSelectable)
		return;

	if (pTeam != m_hTeam)
		return;

	unittype_t eUnit = pSelectable->GetUnitType();
	CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

	for (size_t i = 0; i < pTreeGroup->m_apNodes.size(); i++)
	{
		CSceneTreeUnit* pUnit = dynamic_cast<CSceneTreeUnit*>(pTreeGroup->m_apNodes[i]);
		if (!pUnit)
			continue;

		if (pUnit->GetEntity() == pSelectable)
		{
			RemoveNode(pUnit);
			pUnit->Destructor();
			pUnit->Delete();

			if (pTreeGroup->m_apNodes.size() == 0)
			{
				RemoveNode(pTreeGroup);
				pTreeGroup->Destructor();
				pTreeGroup->Delete();
			}

			break;
		}
	}

	Layout();
}

CSceneTreeGroup::CSceneTreeGroup(unittype_t eUnit, glgui::CTree* pTree)
	: CSceneTreeNode(NULL, pTree)
{
	m_eUnit = eUnit;
}

void CSceneTreeGroup::Paint(int x, int y, int w, int h, bool bFloating)
{
	if (!IsVisible())
		return;

	BaseClass::Paint(x, y, w, h, bFloating);

	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	CRenderingContext c(GameServer()->GetRenderer());
	c.SetBlend(BLEND_ALPHA);

	CHUD::PaintUnitSheet(m_eUnit, x+h, y, h, h, pCurrentLocalTeam?pCurrentLocalTeam->GetColor():Color(255,255,255,255));
}

CSceneTreeUnit::CSceneTreeUnit(CEntityHandle<CSelectable> hEntity, glgui::CTreeNode* pParent, glgui::CTree* pTree)
	: CSceneTreeNode(pParent, pTree)
{
	m_hEntity = hEntity;
}

void CSceneTreeUnit::Paint(int x, int y, int w, int h, bool bFloating)
{
	if (!IsVisible())
		return;

	BaseClass::Paint(x, y, w, h, bFloating);

	if (m_hEntity == NULL)
		return;

	CRenderingContext c(GameServer()->GetRenderer());
	c.SetBlend(BLEND_ALPHA);

	Color clrTeam = m_hEntity->GetTeam()?m_hEntity->GetTeam()->GetColor():Color(255,255,255,255);

	CDigitank* pTank = dynamic_cast<CDigitank*>(m_hEntity.GetPointer());
	if (pTank && !pTank->NeedsOrders())
		clrTeam.SetAlpha(100);

	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	if (pCurrentLocalTeam && pCurrentLocalTeam->IsSelected(m_hEntity))
	{
		Color clrSelection(255, 255, 255, 64);
		if (pCurrentLocalTeam->IsPrimarySelection(m_hEntity))
			clrSelection = Color(255, 255, 255, 128);

		glgui::CRootPanel::PaintRect(x+h, y, h, h, clrSelection);

		clrSelection = Color(255, 255, 255, 128);
		if (pCurrentLocalTeam->IsPrimarySelection(m_hEntity))
			clrSelection = Color(255, 255, 255, 255);

		glgui::CRootPanel::PaintRect(x+h, y, h, 1, clrSelection);
		glgui::CRootPanel::PaintRect(x+h, y, 1, h, clrSelection);
		glgui::CRootPanel::PaintRect(x+h+h, y, 1, h, clrSelection);
		glgui::CRootPanel::PaintRect(x+h, y+h, h, 1, clrSelection);
	}

	CHUD::PaintUnitSheet(m_hEntity->GetUnitType(), x+h+2, y+2, h-4, h-4, clrTeam);

	glgui::CRootPanel::PaintRect(x+h, y - 3, (int)(h*m_hEntity->GetHealth()/m_hEntity->GetTotalHealth()), 3, Color(100, 255, 100));

	if (pTank)
	{
		float flAttackPower = pTank->GetBaseAttackPower(true);
		float flDefensePower = pTank->GetBaseDefensePower(true);
		float flMovementPower = pTank->GetUsedMovementEnergy(true);
		float flTotalPower = pTank->GetStartingPower();
		flAttackPower = flAttackPower/flTotalPower;
		flDefensePower = flDefensePower/flTotalPower;
		flMovementPower = flMovementPower/pTank->GetMaxMovementEnergy();

		glgui::CRootPanel::PaintRect(x+h, y, (int)(h*flAttackPower), 3, Color(255, 0, 0));
		glgui::CRootPanel::PaintRect(x+h+(int)(h*flAttackPower), y, (int)(h*flDefensePower), 3, Color(0, 0, 255));
		glgui::CRootPanel::PaintRect(x+h, y + 3, (int)(h*flMovementPower), 3, Color(255, 255, 0));

		size_t iSize = 22;
		CHUD::PaintWeaponSheet(pTank->GetCurrentWeapon(), x+h+h+4, y+4, iSize, iSize, Color(255, 255, 255, 255));

		size_t iX = x+h+h+h+4;

		if (pTank->IsFortified() || pTank->IsFortifying())
		{
			glgui::CRootPanel::PaintTexture(CDigitank::GetFortifyIcon(), iX, y+4, iSize, iSize);
			iX += h;
		}

		if (pTank->IsSentried())
		{
			glgui::CRootPanel::PaintTexture(CDigitank::GetSentryIcon(), iX, y+4, iSize, iSize);
			iX += h;
		}
	}

	CStructure* pStructure = dynamic_cast<CStructure*>(m_hEntity.GetPointer());
	if (pStructure && (pStructure->IsConstructing() || pStructure->IsUpgrading()))
	{
		int iTurnsRemaining = 0;
		int iTotalTurns = 0;
		if (pStructure->IsConstructing())
		{
			iTurnsRemaining = pStructure->GetTurnsToConstruct();
			iTotalTurns = pStructure->GetTurnsRemainingToConstruct();
		}
		else if (pStructure->IsUpgrading())
		{
			iTurnsRemaining = pStructure->GetTurnsToUpgrade();
			iTotalTurns = pStructure->GetTurnsRemainingToUpgrade();
		}

		int iTurns = iTotalTurns-iTurnsRemaining;
		glgui::CRootPanel::PaintRect(x+h, y+h-1, (int)((float)h*iTurns/iTotalTurns), 3, Color(255, 255, 100));
	}
}

void CSceneTreeUnit::Selected()
{
	if (m_hEntity != NULL)
	{
		CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

		if (DigitanksWindow()->IsShiftDown())
			pCurrentLocalTeam->AddToSelection(m_hEntity);
		else
		{
			pCurrentLocalTeam->SetPrimarySelection(m_hEntity);
			DigitanksGame()->GetDigitanksCamera()->SetTarget(m_hEntity->GetOrigin());
		}

		DigitanksWindow()->GetInstructor()->FinishedTutorial(CInstructor::TUTORIAL_INGAME_ARTILLERY_SELECT, true);
		if (m_hEntity->GetUnitType() == UNIT_MOBILECPU)
			DigitanksWindow()->GetInstructor()->FinishedTutorial(CInstructor::TUTORIAL_INGAME_STRATEGY_SELECT, true);
	}

	BaseClass::Selected();
}

CSceneTreeNode::CSceneTreeNode(glgui::CTreeNode* pParent, glgui::CTree* pTree)
	: glgui::CTreeNode(pParent, pTree, L"")
{
}

void CSceneTreeNode::Paint(int x, int y, int w, int h, bool bFloating)
{
	BaseClass::Paint(x, y, w, h, bFloating);
}
<commit_msg>Reorganize the scene tree.<commit_after>#include "scenetree.h"

#include <game/gameserver.h>
#include <game/digitanks/digitanksgame.h>
#include "digitankswindow.h"
#include "hud.h"
#include <renderer\renderer.h>
#include <game/digitanks/dt_camera.h>
#include "instructor.h"

CSceneTree::CSceneTree()
	: CTree(CRenderer::LoadTextureIntoGL(L"textures/hud/arrow.png"), 0, 0)
{
}

void CSceneTree::Layout()
{
	SetSize(90, glgui::CRootPanel::Get()->GetHeight()-300);
	SetPos(15, 60);

	BaseClass::Layout();
}

void CSceneTree::BuildTree(bool bForce)
{
	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	if (!pCurrentLocalTeam)
		return;

	if (m_hTeam == pCurrentLocalTeam && !bForce)
		return;

	ClearTree();

	m_hTeam = pCurrentLocalTeam;

	for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
	{
		CSelectable* pEntity = CBaseEntity::GetEntityType<CSelectable>(i);
		if (!pEntity)
			continue;

		if (pEntity->GetDigitanksTeam() != pCurrentLocalTeam)
			continue;

		unittype_t eUnit = pEntity->GetUnitType();

		if (eUnit == STRUCTURE_BUFFER)
			continue;

		if (eUnit == STRUCTURE_MINIBUFFER)
			continue;

		if (eUnit == STRUCTURE_BATTERY)
			continue;

		if (eUnit == STRUCTURE_PSU)
			continue;

		CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

		pTreeGroup->AddNode(new CSceneTreeUnit(pEntity, pTreeGroup, this));
	}

	Layout();
}

CSceneTreeGroup* CSceneTree::GetUnitNode(unittype_t eUnit)
{
	for (size_t i = 0; i < m_apNodes.size(); i++)
	{
		CSceneTreeGroup* pTreeGroup = dynamic_cast<CSceneTreeGroup*>(m_apNodes[i]);
		if (eUnit == pTreeGroup->GetUnitType())
			return pTreeGroup;

		if (pTreeGroup->GetUnitType() == STRUCTURE_CPU)
		{
			if (eUnit == STRUCTURE_INFANTRYLOADER)
				return pTreeGroup;
			if (eUnit == STRUCTURE_TANKLOADER)
				return pTreeGroup;
			if (eUnit == STRUCTURE_ARTILLERYLOADER)
				return pTreeGroup;
		}
	}

	// It's not there. Insert it.
	for (size_t i = 0; i < m_apNodes.size(); i++)
	{
		CSceneTreeGroup* pTreeGroup = dynamic_cast<CSceneTreeGroup*>(m_apNodes[i]);
		if (eUnit < pTreeGroup->GetUnitType())
		{
			CSceneTreeGroup* pReturn = new CSceneTreeGroup(eUnit, this);
			AddNode(pReturn, i);
			return pReturn;
		}
	}

	CSceneTreeGroup* pReturn = new CSceneTreeGroup(eUnit, this);
	AddNode(pReturn);
	return pReturn;
}

void CSceneTree::Paint(int x, int y, int w, int h)
{
	glgui::CRootPanel::PaintRect(x, y, w, h, m_clrBackground);

	if (m_iHilighted != ~0)
	{
		IControl* pNode = m_apControls[m_iHilighted];
		int cx, cy, cw, ch;
		pNode->GetAbsDimensions(cx, cy, cw, ch);
		glgui::CRootPanel::PaintRect(cx+ch, cy, ch, ch, Color(255, 255, 255, 100));
	}

	// Skip CTree, we override its hilight and selection methods.
	CPanel::Paint(x, y, w, h);
}

void CSceneTree::OnAddEntityToTeam(CDigitanksTeam* pTeam, CBaseEntity* pEntity)
{
	CSelectable* pSelectable = dynamic_cast<CSelectable*>(pEntity);
	if (!pSelectable)
		return;

	if (pTeam != m_hTeam)
		return;

	unittype_t eUnit = pSelectable->GetUnitType();

	if (eUnit == STRUCTURE_BUFFER)
		return;

	if (eUnit == STRUCTURE_MINIBUFFER)
		return;

	if (eUnit == STRUCTURE_BATTERY)
		return;

	if (eUnit == STRUCTURE_PSU)
		return;

	CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

	pTreeGroup->AddNode(new CSceneTreeUnit(pSelectable, pTreeGroup, this));

	Layout();
}

void CSceneTree::OnRemoveEntityFromTeam(CDigitanksTeam* pTeam, CBaseEntity* pEntity)
{
	CSelectable* pSelectable = dynamic_cast<CSelectable*>(pEntity);
	if (!pSelectable)
		return;

	if (pTeam != m_hTeam)
		return;

	unittype_t eUnit = pSelectable->GetUnitType();

	if (eUnit == STRUCTURE_BUFFER)
		return;

	if (eUnit == STRUCTURE_MINIBUFFER)
		return;

	if (eUnit == STRUCTURE_BATTERY)
		return;

	if (eUnit == STRUCTURE_PSU)
		return;

	CSceneTreeGroup* pTreeGroup = GetUnitNode(eUnit);

	for (size_t i = 0; i < pTreeGroup->m_apNodes.size(); i++)
	{
		CSceneTreeUnit* pUnit = dynamic_cast<CSceneTreeUnit*>(pTreeGroup->m_apNodes[i]);
		if (!pUnit)
			continue;

		if (pUnit->GetEntity() == pSelectable)
		{
			RemoveNode(pUnit);
			pUnit->Destructor();
			pUnit->Delete();

			if (pTreeGroup->m_apNodes.size() == 0)
			{
				RemoveNode(pTreeGroup);
				pTreeGroup->Destructor();
				pTreeGroup->Delete();
			}

			break;
		}
	}

	Layout();
}

CSceneTreeGroup::CSceneTreeGroup(unittype_t eUnit, glgui::CTree* pTree)
	: CSceneTreeNode(NULL, pTree)
{
	m_eUnit = eUnit;
}

void CSceneTreeGroup::Paint(int x, int y, int w, int h, bool bFloating)
{
	if (!IsVisible())
		return;

	BaseClass::Paint(x, y, w, h, bFloating);

	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	CRenderingContext c(GameServer()->GetRenderer());
	c.SetBlend(BLEND_ALPHA);

	CHUD::PaintUnitSheet(m_eUnit, x+h, y, h, h, pCurrentLocalTeam?pCurrentLocalTeam->GetColor():Color(255,255,255,255));
}

CSceneTreeUnit::CSceneTreeUnit(CEntityHandle<CSelectable> hEntity, glgui::CTreeNode* pParent, glgui::CTree* pTree)
	: CSceneTreeNode(pParent, pTree)
{
	m_hEntity = hEntity;
}

void CSceneTreeUnit::Paint(int x, int y, int w, int h, bool bFloating)
{
	if (!IsVisible())
		return;

	BaseClass::Paint(x, y, w, h, bFloating);

	if (m_hEntity == NULL)
		return;

	CRenderingContext c(GameServer()->GetRenderer());
	c.SetBlend(BLEND_ALPHA);

	Color clrTeam = m_hEntity->GetTeam()?m_hEntity->GetTeam()->GetColor():Color(255,255,255,255);

	CDigitank* pTank = dynamic_cast<CDigitank*>(m_hEntity.GetPointer());
	if (pTank && !pTank->NeedsOrders())
		clrTeam.SetAlpha(100);

	CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

	if (pCurrentLocalTeam && pCurrentLocalTeam->IsSelected(m_hEntity))
	{
		Color clrSelection(255, 255, 255, 64);
		if (pCurrentLocalTeam->IsPrimarySelection(m_hEntity))
			clrSelection = Color(255, 255, 255, 128);

		glgui::CRootPanel::PaintRect(x+h, y, h, h, clrSelection);

		clrSelection = Color(255, 255, 255, 128);
		if (pCurrentLocalTeam->IsPrimarySelection(m_hEntity))
			clrSelection = Color(255, 255, 255, 255);

		glgui::CRootPanel::PaintRect(x+h, y, h, 1, clrSelection);
		glgui::CRootPanel::PaintRect(x+h, y, 1, h, clrSelection);
		glgui::CRootPanel::PaintRect(x+h+h, y, 1, h, clrSelection);
		glgui::CRootPanel::PaintRect(x+h, y+h, h, 1, clrSelection);
	}

	CHUD::PaintUnitSheet(m_hEntity->GetUnitType(), x+h+2, y+2, h-4, h-4, clrTeam);

	glgui::CRootPanel::PaintRect(x+h, y - 3, (int)(h*m_hEntity->GetHealth()/m_hEntity->GetTotalHealth()), 3, Color(100, 255, 100));

	if (pTank)
	{
		float flAttackPower = pTank->GetBaseAttackPower(true);
		float flDefensePower = pTank->GetBaseDefensePower(true);
		float flMovementPower = pTank->GetUsedMovementEnergy(true);
		float flTotalPower = pTank->GetStartingPower();
		flAttackPower = flAttackPower/flTotalPower;
		flDefensePower = flDefensePower/flTotalPower;
		flMovementPower = flMovementPower/pTank->GetMaxMovementEnergy();

		glgui::CRootPanel::PaintRect(x+h, y, (int)(h*flAttackPower), 3, Color(255, 0, 0));
		glgui::CRootPanel::PaintRect(x+h+(int)(h*flAttackPower), y, (int)(h*flDefensePower), 3, Color(0, 0, 255));
		glgui::CRootPanel::PaintRect(x+h, y + 3, (int)(h*flMovementPower), 3, Color(255, 255, 0));

		size_t iSize = 22;
		CHUD::PaintWeaponSheet(pTank->GetCurrentWeapon(), x+h+h+4, y+4, iSize, iSize, Color(255, 255, 255, 255));

		size_t iX = x+h+h+h+4;

		if (pTank->IsFortified() || pTank->IsFortifying())
		{
			glgui::CRootPanel::PaintTexture(CDigitank::GetFortifyIcon(), iX, y+4, iSize, iSize);
			iX += h;
		}

		if (pTank->IsSentried())
		{
			glgui::CRootPanel::PaintTexture(CDigitank::GetSentryIcon(), iX, y+4, iSize, iSize);
			iX += h;
		}
	}

	CStructure* pStructure = dynamic_cast<CStructure*>(m_hEntity.GetPointer());
	if (pStructure && (pStructure->IsConstructing() || pStructure->IsUpgrading()))
	{
		int iTurnsRemaining = 0;
		int iTotalTurns = 0;
		if (pStructure->IsConstructing())
		{
			iTurnsRemaining = pStructure->GetTurnsToConstruct();
			iTotalTurns = pStructure->GetTurnsRemainingToConstruct();
		}
		else if (pStructure->IsUpgrading())
		{
			iTurnsRemaining = pStructure->GetTurnsToUpgrade();
			iTotalTurns = pStructure->GetTurnsRemainingToUpgrade();
		}

		int iTurns = iTotalTurns-iTurnsRemaining;
		glgui::CRootPanel::PaintRect(x+h, y+h-1, (int)((float)h*iTurns/iTotalTurns), 3, Color(255, 255, 100));
	}
}

void CSceneTreeUnit::Selected()
{
	if (m_hEntity != NULL)
	{
		CDigitanksTeam* pCurrentLocalTeam = DigitanksGame()->GetCurrentLocalDigitanksTeam();

		if (DigitanksWindow()->IsShiftDown())
			pCurrentLocalTeam->AddToSelection(m_hEntity);
		else
		{
			pCurrentLocalTeam->SetPrimarySelection(m_hEntity);
			DigitanksGame()->GetDigitanksCamera()->SetTarget(m_hEntity->GetOrigin());
		}

		DigitanksWindow()->GetInstructor()->FinishedTutorial(CInstructor::TUTORIAL_INGAME_ARTILLERY_SELECT, true);
		if (m_hEntity->GetUnitType() == UNIT_MOBILECPU)
			DigitanksWindow()->GetInstructor()->FinishedTutorial(CInstructor::TUTORIAL_INGAME_STRATEGY_SELECT, true);
	}

	BaseClass::Selected();
}

CSceneTreeNode::CSceneTreeNode(glgui::CTreeNode* pParent, glgui::CTree* pTree)
	: glgui::CTreeNode(pParent, pTree, L"")
{
}

void CSceneTreeNode::Paint(int x, int y, int w, int h, bool bFloating)
{
	BaseClass::Paint(x, y, w, h, bFloating);
}
<|endoftext|>